Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
February 7, 2021 10:57 am GMT

CSS: How to make a website responsive

Hello World! The third episode of the series - A CSS/JS trick in 5 minutes - Last Article was about a CSS trick (How to make a gradient animation).
This time I want to show you another CSS trick: How to make a website responsive (or how media queries work).

It's not very difficult, I just want to underline some important things. First, when you want to do something responsive always use Google device toolbar while having this in mind:
Alt Text

Then you add a media query for these 5 different screen sizes:

@media only screen and (max-width: 1200px) {  body {    // Change design here   }}
Enter fullscreen mode Exit fullscreen mode

I recommend you start copying your 5 media queries and then editing one at once. Remember to check frequently your website to be sure of what you're doing.

You can also use media queries to check screen resolution (in dpi) and orientation.

@media (orientation: landscape / portrait) {  body {    // Change design here   }}@media (resolution: 150dpi) {  body {    // Change design here   }}
Enter fullscreen mode Exit fullscreen mode

I created for example a responsive title here:
Click Me

Hope this helped and thanks for reading!

Please smash that like button to make me understand that you want the series to continue :)


Original Link: https://dev.to/devlorenzo/css-how-to-make-a-website-responsive-19kg

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To