html - How to use media queries properly -
i designing responsive web page. have div width should decrease when screen size decreases.
this div contains list of 2 image links. should remain inline when screen width decrease.
/* css */ div.mymenu{ margin-right:7%; margin-top:-53px; background:#000; width: 28.5%; opacity:0.8; } div.mymenu > .nav-pills{ margin-bottom:7px; } div.mymenu > .nav-pills a{ color:#fff; margin-left: 30%; } div.mymenu > .nav-pills a:hover{ background:none; } <!-- html --> <div class="mymenu pull-right"> <ul class="nav nav-pills"> <li><a href="">why us</a></li> <li><a href=""><img src="img/news.png" /></a></li> <li><a href=""><img src="img/help.png" /></a></li> </ul> </div>
i using twitter bootstrap. tried making changes bootstrap-responsive.css - no change. made changes such :-
@media (min-width: 768px) , (max-width: 979px) { .mymenu{ width: 20%; } }
your current media query going limit styles browsers between 768px
, 979px
. remove 2nd media query (979) have apply viewports wider 768 px
.
@media (min-width: 768px) { .mymenu { width: 20%; } }
also, note, i'd suggest trimming selectors div.mymenu
down .mymenu
div
limits applicability of selector (perhaps want ul
have same styles .mymenu
) , it's more typing : )
Comments
Post a Comment