The content of this article is about the animated responsive layout of CSS3 media queries. Friends who are interested can take a look. Let’s take a look at the main content.
What are media queries
CSS3 brings us many new features that we use for web design, one of the features that can help improve the usability of a website is Media Inquiries.
Media QueriesBoilerplate
/* Smartphones (portrait and landscape) ———– */ @media only screen and (min-width : 320px) and (max-width : 480px) { /* Styles */ } /* Smartphones (landscape) ———– */ @media only screen and (min-width : 321px) { /* Styles */ } /* Smartphones (portrait) ———– */ @media only screen and (max-width : 320px) { /* Styles */ } /* iPads (portrait and landscape) ———– */ @media only screen and (min-width : 768px) and (max-width : 1024px) { /* Styles */ } /* iPads (landscape) ———– */ @media only screen and (min-width : 768px) and (max-width : 1024px) and (orientation : landscape) { /* Styles */ } /* iPads (portrait) ———– */ @media only screen and (min-width : 768px) and (max-width : 1024px) and (orientation : portrait) { /* Styles */ } /* Desktops and laptops ———– */ @media only screen and (min-width : 1224px) { /* Styles */ } /* Large screens ———– */ @media only screen and (min-width : 1824px) { /* Styles */ } /* iPhone 4 ———– */ @media only screen and (-webkit-min-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5) { /* Styles */ }
Animated Layout Changes
Using CSS we can add animations to your different elements and we can also assign animations to Different properties of these elements.
If we use media queries, then we will most likely change the width and height of the element so that it can fit on the page. We know that both width and height change, we can use the following code to add animation to the width and height CSS properties.
/* webkit */ -webkit-animation-property: -webkit-width; -webkit-animation-property: -webkit-height; -webkit-transition-duration: 1s; /* moz */ -moz-animation-property: -moz-width; -moz-animation-property: -moz-height; -moz-transition-duration: 1s; /* opera */ -o-animation-property: -o-width; -o-animation-property: -o-height; -o-transition-duration: 1s;
The above is the detailed content of Animated responsive layout with CSS3 media queries. For more information, please follow other related articles on the PHP Chinese website!