HS Article

CSS Media Queries for Responsive Web Design

CSS media queries are an excellent way of changing your CSS for any device, tablet, or smartphone to create a better user experience and look of your website. Media queries can target your CSS for different screen sizes, orientations, and/or resolutions so that your content is easily readable while ensuring that user layouts are maintained between screens such as desktops tablets and smartphones.

🎨
filename.css
/* Small Phones */
@media only screen and (max-width: 480px) {
}

/* Phones / Mobile */
@media only screen and (min-width: 481px) and (max-width: 767px) {
}

/*for all mobile*/
@media only screen and (max-width:767px) {}

/* Mobile Landscape */
@media only screen and (max-width: 767px) and (orientation: landscape) {
}

/* Tablet Portrait */
@media only screen and (min-width: 768px) and (max-width: 1024px) {
}

/* Tablet Landscape */
@media only screen and (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
}

/* Small Laptop */
@media only screen and (min-width: 1025px) and (max-width: 1199px) {
}

/* Desktop */
@media only screen and (min-width: 1200px) and (max-width: 1439px) {
}

/* Large Desktop */
@media only screen and (min-width: 1440px) {
}

Why Media Queries are Important:

  • Better UX: Change your designs, fonts, and so on so your website not only looks like but also acts well on every device user.
  • Better Performance: Load all styles or resources for every device, on every device.
  • Efficiency: One responsive website is now the only, and effective, version instead of mobile and desktop sites.

Conclusion:

Using media queries are paramount for modern web design. This will make your website responsive, mobile friendly, and good looking in a responsive design and drastically improve both the user experience as well as the overall performance of your site.

5 2 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Wordpress contact form not sending email

WordPress Contact Form Not Working? SMTP Fix That Works

Your form doesn’t always submit cleanly either, sometimes it...

Read More
Best math captcha plugin

Free Math CAPTCHA Plugin for WordPress Forms (No API Key Needed)

Quick Answer: If your WordPress contact form keeps getting...

Read More
fix missing alt text in wordpress

How to Fix Missing Alt Text in WordPress (Step-by-Step)

If you have ever run an SEO audit or...

Read More
Choose a Color Palette for Your Website

How to Choose a Color Palette for Your Website

Quick answer: Start with one color that matches the...

Read More
Core Web Vitals: Why Your Rankings Might Have Dropped

Core Web Vitals in 2026: What Actually Changed and Why Your Rankings Might Have Dropped

If your traffic has dipped this year and you...

Read More
reading time calculator

How Long Should a Blog Post Be? Word Count Guide by Content Type

Every writer hits this question eventually. You finish a...

Read More
How to install wordpress on localhost using XAMPP

How to Install WordPress on Localhost Using XAMPP: A Step by Step Guide

If you’re building or testing a WordPress site, you...

Read More
Best Gradient tool

10 Best CSS Gradient Tools in 2026 (Generators, Galleries & Mesh Gradients Compared)

Searching for the best css gradient tools usually turns...

Read More
CSS hover effects

70+ CSS Hover Effects (Free Code, Copy & Paste)

CSS Button Hover Effects PreviewHTMLCSSCopy Get startedGet started Fill...

Read More
How to add GST/Tax in woocommerce

How to Add Tax/GST in WooCommerce: Full Setup Guide

Every WooCommerce store eventually has to deal with tax,...

Read More

About

HSArticle logo

HS Article is a free resource for Designers & Developers. Explore free tools, free plugins, WordPress fixes, Instagram ideas, and interactive quizzes - all in one place.