[英]How to make the header take up the full width when zooming out?
When i zoom out the header doesn't take up the full-width of the page. 当我缩小页面时,标题不会占据页面的整个宽度。 I have two images the first is how it is supposed to look when zooming out and the second one is where it doesn't take up the full width. 我有两张图片,第一张是缩小时的外观,第二张是不占全宽的位置。
I have tried with width:100%
in the header, but it doesn't work. 我尝试在标题中使用width:100%
,但是它不起作用。
* {
padding: 0;
margin: 0;
box-sizing: border-box;}
html {
width: 100%;
max-width: 1600px;
margin-left: auto;
margin-right: auto;
background-color: #000;
font-family: 'Lato', sans-serif;
font-size: 62.5%;
line-height: 1.2;
color: #fff;}
header {
background-color: var(--background-color);
width:100%;}
Edit 1:- Change margin-left to 0px and margin-right to 0px. 编辑1:-将margin-left更改为0px,margin-right更改为0px。 make max-width: 100%;. 使最大宽度:100%;.
html {
width: 100%;
max-width: 100%;
margin-left: 0;
margin-right: 0;
background-color: #000;
font-family: 'Lato', sans-serif;
font-size: 62.5%;
line-height: 1.2;
color: #fff;
}
Edit -2 :- as far as i understood , your problem now is to set the other sections centered. 编辑-2:-据我了解,您现在的问题是将其他部分居中设置。 follow this how to center things in css . 遵循此方法如何使CSS中的内容居中 。 If it sill doesn't solve the problem please edit the above fiddle accordingly and specify the requirements clearly (like using id's) 如果仍然不能解决问题,请相应地编辑上面的小提琴并明确指定要求(例如使用ID)
Edit -3:- Please follow the sample fiddle. 编辑-3:-请遵循小提琴示例。 fiddle 小提琴
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.