Here in the image below the list is going out of the screen. I need to block the width of the ul. Width applied but going out of the ul width. Current CSS Used:
.menu ul{
width:100%;
max-width:100%;
}
Try this
.menu li {
display: inline-block;
}
Decent support and here's a nice round up .
If there's a
margin-left
try not to set the width to 100%
, but rather 100% - margin-left-value
padding-left
use box-sizing: border-box
If you don't have to support older browsers or are fine with loading a polyfill, flexbox model would do the job.
display: inline; or display: inline-block;
Both works.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.