简体   繁体   中英

Navbar background filling screen width, whilst all content within min-width and max-width values

I'm creating a fluid website design and am specifying min-width and max-width values, however, I'd like the navigation bar background to extend from one side of the screen to the other (not be constrained by the max width), whilst keeping all of the <li> elements in it and all other screen content within the specified widths.

Furthermore, I would also like to set a minimum margin for the page (eg 16px) so that there is always a gap between the content and the edge of the page.

Ideally as in the image below: 设计

What's the best way to go about containing everything inside the min-width and max-width values, whilst allowing the navbar background to stretch to the screen width. Also, is there a way I can use margin-left: auto and yet keep a minimum margin value? Whenever I've tried to do this I can only get one or the other.

Thanks for any help in advance.

有几种不同的方法可以做到这一点,但这个jsFiddle说明了我将如何做到这一点: http//jsfiddle.net/joshnh/UDwcp/

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.

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