I have a code like this:
/*footer*/ footer{ position:relative; display:block; padding:15px; text-align:center; background:#000; margin:0 169px; } /*Footer*/ @media only screen and (min-width:600px){ #footer-wrapper .footer{ float:left; width:100%; display:block; margin:0 auto } } @media only screen and (min-width:768px){ #footer-wrapper .footer{ width:100%; margin:0 auto } } @media only screen and (min-width:992px){ #footer-wrapper .footer{ width:100%; margin:0 auto } }
on the desktop, I have 169px right and left. but in mobile I have an edge on the right and left 169 pixels. I want to remove this margin in the mobile version. But my @media screen is not working.
1) Use max-widthinstead min-width.
max-width
min-width
2) (min-width:768x) and (min-width-922px) in @media Queryhave the same style, so you can combine them.
(min-width:768x) and (min-width-922px)
@media Query
Note. To view the result, use full pageand resize the browser.
full page
body { margin: 0; } footer{position:relative;display:block;padding:15px;text-align:center;background:#000;margin:0 169px;} /*Footer*/ @media only screen and (max-width:600px){#footer-wrapper .footer{float:left;width:100%;display:block; margin:0 auto} @media only screen and (min-width:768px) and (max-width:992px){#footer-wrapper .footer{width:100%; margin:0 auto}
<div id="footer-wrapper"> <footer class="footer"> This is Footer </footer> </div>
@media max-width:400px, logo class none, , min-width:400px, .
@media max-width:400px
logo class
min-width:400px
@media screen and (max-width: 400px){ .logo{ display: none; } } @media screen and (min-width: 400px){ .brand1{ display: inline; } }
min
max
try it
/*For Desktops*/ @media only screen and (min-width:768px){ footer{ position:relative; display:block; padding:15px; text-align:center; background:#000; margin:0 169px; } } /*For Mobile Devices*/ @media only screen and (max-width:767px){ #footer-wrapper .footer{ width:100%; margin:0 auto } }
To learn more about @media, follow this link: @media for responsive website design
Source: https://habr.com/ru/post/1681320/More articles:Absolute positioning - cssNuget Package Management Packs VS2017 - nugetSpringBoot не обрабатывает javax.validation.ConstraintViolationException - javaПочему map.merge() не вызывает функцию переназначения каждый раз? - javaNuget Package Manager crashes when you click Manage nuget Packages for Solution. Visual Studio 2015 - visual-studio-2015Javascript: как определить, имеет ли текущая страница форму с определенным именем и вводом - javascriptaccess to the kotlin extension in another kt - kotlinDrop-down list of multiple options with jquery - javascriptmsg: Can't find getter for attribute 'android: text' with value of type java.lang.String in data binding? - androidA deep nested array of non-displaying objects - javascriptAll Articles