[英]css navbar responsive padding issue
I have a navbar every thing looks great until it goes responsive. 我有一个导航栏,直到一切变得灵敏为止,一切看起来都很不错。 the bottom drop down has a 5 px gap all the way around it.
底部的下拉菜单始终有5 px的间隙。
https://jsfiddle.net/nc2hamed/5/ https://jsfiddle.net/nc2hamed/5/
i have tried adding and removing padding on the 我试图在上添加和删除填充
.expand {
max-height: 40em;
}
You should remove some padding-top
on .navbar .menu
and set the max-width
to 100%
您应该在
.navbar .menu
上删除一些padding-top
并将max-width
设置为100%
@media(your_media_query) {
.navbar .menu {
padding-top: 25px;
}
.wrap {
width: 100%;
max-width: 100%;
}
}
Your problem is in your .navbar .menu
element. 您的问题出在
.navbar .menu
元素中。 You need to set the padding-top
to 0px
unless your screen height is not mobile. 除非屏幕高度不能移动,否则您需要将
padding-top
设置为0px
。
The top gap is because your .menu has big padding-top. 顶部的差距是因为您的.menu具有较大的填充顶部。 The left and right gaps are there because your .wrap has width: 95% (not 100%).
因为您的.wrap的宽度为:95%(不是100%),所以存在左右间隙。 So this code will fix both issues:
因此,此代码将解决两个问题:
.navbar {
width: 105%;
margin: 0 -2.5%;
}
@media only screen and (min-width: 800px) {
.navbar {
width: auto;
margin: 0;
}
.navbar .menu {
padding-top: 20px;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.