css - How to Keep Nav bar from shifting when window resized -
i new html/css. problem when re-size browser window text of nav-bar shifts/condenses according size of window , becomes distorted. remain static when narrow browser window have have scroll on right able see text again. i'm using bootstrap well.
this code:
html
<body> <div class="nav"> <div class="container"> <ul class="pull-right"> <li><a href="#">home</a></li> <li><a href="#">wines</a></li> <li><a href="#">grapes</a></li> <li><a href="#">about us</a></li> </ul> </div> </div> </body>
css
.nav li { display: inline; } .nav { color: #5a5a5a; font-size: 20px; font-weight: bold; padding: 14px 10px; } .nav { position: absolute; top: 20px; right: 0px; }
i tried using .container {width: 900px;}
didn't help. nav bar still doesn't stay static.
you can solve adding minimum width div surrounding nav bar.
in case in .nav class
.nav { min-width:165px; position: absolute; top: 20px; right: 0px; }
i don't know if shared code us, code provided 165px should fine minimum width. if there more code present makes navbar different width may need adjust pixel amount of min-width:
.
Comments
Post a Comment