html - My nav bar collapses at 300px width. Elements inside nav bar collapse at 400px -
my code sloppy , don't know how use media queries. i've been feeling way around , have sloppy unresponsive nav bar. please me fix it. collapses @ 300px width , elements inside weird @ 400px. i'd know better way write media queries. whenever want change feel have add million of them though don't.
.nav { width: 100%; height: 5%; border-bottom: 2px solid white; background-color: #333333; z-index: 98; text-align: center; position: fixed; padding: 1% 0; top: 0; } .nav ul li { display: inline-block; width: 20%; list-style-type: none; margin: 1% 0 0 0; z-index: 99; } .nav ul li { text-decoration: none; color: white; padding: 5px 20px; border: 2px solid #c6b99c; transition: background .5s; font-family: times; } .nav ul li a:hover { transition: background .5s; background-color: #c6b99c; } .nav ul li a:active { transition: background .5s; background-color: #c6b99c; } #btn { border-radius: 0; border: 2px solid #95747f; transition: background .5s; } #btn:hover { background-color: #95747f; transition: background .5s; } #btn:active { background-color: #95747f; transition: background .5s; } @media (max-width: 2560px) { .nav ul li { font-size: 50px; width: 20px; } .nav { padding-bottom: 10px; height: 15%; } } @media (max-width: 1440px) { .nav ul li { font-size: 20px; width: 15px; } .main h1 { font-size: 40px; } .nav { height: 10%; } } @media (max-width: 420px) { .nav { height: 5%; } .nav ul li { font-size: 14px; } } @media (max-width: 1440px) { .nav ul li { font-size: 20px; width: 15px; } .main h1 { font-size: 40px; } .nav { height: 5%; } } @media(max-width: 1000px) { .nav { height: 10%; } } @media(max-width: 2560px) { .nav { height: 10%; } } @media(max-width: 420px) { .nav { height: 2%; } .nav ul li { font-size: 14px; } } @media(max-width: 688px) { iframe { width: 300px; } .nav ul li { padding: 5px 10px; font-size: 15px; margin: 10px 10px; } }
<div class="nav"> <ul> <li><a href="space-page-home.html">home</a></li> <li><a href="">about</a></li> <li><a href="space-page-blog.html" id="btn">blog</a></li> <li><a href="space-page-pics.html">space pics</a></li> </ul> </div>
first of never give height bar. try make possible using padding. regarding media queries, have ipad resolution i.e 768 * 1024, below ipad mobile. can following:
@media(max-width:767px){ here can define responsive styles mobile view. can resize screen smallest screen resolution i.e iphone 4 320 * 480. according whatever size required, can define once. applicable devices. }
Comments
Post a Comment