Reputation: 751
Is there a media query that covers all devices as all I can find online and when researching is media queries for specific devices? I can create media queries for lots of devices being specific to the devices however I was hoping there was a blanket media query that covered all devices. So far I have only created a media query for ipad as you can see below.
@media only screen and (device-width: 768px) {
#menu {
font-weight: 400;
display: table;
list-style: none;
top: 60px;
text-align: center;
left: -10px;
-webkit-box-shadow: 0px 3px 5px 0px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 0px 3px 5px 0px rgba(50, 50, 50, 0.75);
box-shadow: 0px 3px 5px 0px rgba(50, 50, 50, 0.75);
font-size: 18px;
height: 20px;
z-index: 1101;
position: fixed;
width: 100%;
}
#apDiv2 {
width: 100%;
height: 70px;
top: 0px;
color: #000000;
background-color: #0263B5;
left: 0;
}
}
Upvotes: 1
Views: 899
Reputation: 3558
Styling that pertains to all devices should not be put inside a media query at all. It should be placed either before or after the media query (or queries).
Edit:
For example, if (for example) your #menu
id is the same for all devices, but your #apDiv2
id needs specific styling for the iPad, then this is how you would change the CSS:
#menu {
font-weight: 400;
display: table;
list-style: none;
top: 60px;
text-align: center;
left: -10px;
-webkit-box-shadow: 0px 3px 5px 0px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 0px 3px 5px 0px rgba(50, 50, 50, 0.75);
box-shadow: 0px 3px 5px 0px rgba(50, 50, 50, 0.75);
font-size: 18px;
height: 20px;
z-index: 1101;
position: fixed;
width: 100%;
}
@media only screen and (device-width: 768px) {
#apDiv2 {
width: 100%;
height: 70px;
top: 0px;
color: #000000;
background-color: #0263B5;
left: 0;
}
}
Or, alternatively, let's assume that you want to control the positional styles for specific devices -- but all other styles are the same on all devices, here's how you'd do that:
#menu {
font-weight: 400;
display: table;
list-style: none;
text-align: center;
-webkit-box-shadow: 0px 3px 5px 0px rgba(50, 50, 50, 0.75);
-moz-box-shadow: 0px 3px 5px 0px rgba(50, 50, 50, 0.75);
box-shadow: 0px 3px 5px 0px rgba(50, 50, 50, 0.75);
font-size: 18px;
z-index: 1101;
position: fixed;
}
#apDiv2 {
color: #000000;
background-color: #0263B5;
}
@media only screen and (device-width: 768px) {
#menu {
top: 60px;
left: -10px;
height: 20px;
width: 100%;
}
#apDiv2 {
width: 100%;
height: 70px;
top: 0px;
left: 0;
}
}
Upvotes: 2