简体   繁体   English

容器未调整到页面的全宽

[英]container not sizing to full width of page

so what I have here is a little ui I'm building.所以我这里有一个我正在构建的小用户界面。 looking at my html it's pretty simple, however I have some weird behavior going on.看看我的 html,它很简单,但是我有一些奇怪的行为。 even though page container wraps the aside and .main element, it appears to be inserting itself into the grid.即使页容器包装的aside.main元素,这似乎是自身插入到电网。 I want to the .main element into the center column of the .page-container 's grid.我想将 .main 元素放入 .page .page-container网格的中心列。 is there something im missing?我有什么遗漏吗?

Anything you guys got would help.你们得到的任何东西都会有所帮助。 thanks!谢谢!

 body{ margin:0; min-height:100vh; } label{ margin:0.9em 0; } .page-container{ display:grid; width:100vw; grid-template-columns:25% 50% 25%; grid-template-rows:100%; grid-template-areas:"margin main margin"; } .main{ grid-area:main; width:100%; height:100%; background-image:url("https://live.staticflickr.com/3771/11167360764_2512d790b3_z.jpg"); } .controls{ width:25%; height:100%; position:absolute; background-color:green; font-family:sans-serif; -webkit-box-shadow: 10px 3px 5px -4px rgba(0,0,0,0.75); -moz-box-shadow: 10px 3px 5px -4px rgba(0,0,0,0.75); box-shadow: 10px 3px 5px -4px rgba(0,0,0,0.75); word-break:break-word; } .controls-wrapper{ margin:3em 5% 5% 1em; }
 <div class="page-container"> <aside class="controls"> <form class="controls-wrapper"> <label for="p_font_size">change paragraphs font size:</label> <br> <select name="" class="p_font_size"> <option value="25pt">25pt</option> <option value="11pt">11pt</option> </select> </form> </aside> <main class="main"> <p>fsdanfdjsanfsdsafdsajansan</p> </main> </div>

The grid-template-rows property defines the height of each row. grid-template-rows 属性定义了每行的高度。 with changing that i think you can get your desire result for example :通过改变,我认为你可以获得你想要的结果,例如:

   .page-container{
      display:grid;
      width:100vw;
      grid-template-columns:auto auto auto;
      grid-template-rows:100% 100% 100%;
      grid-template-areas:"margin main margin";
  }

grid-template-columns:25% 50% 25% works fine too grid-template-columns:25% 50% 25% 也可以正常工作

hope i have understood you problem correctly希望我已经正确理解你的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM