{"id":131,"date":"2026-04-07T04:30:10","date_gmt":"2026-04-07T04:30:10","guid":{"rendered":"https:\/\/gigz.pk\/css\/?post_type=lesson&#038;p=131"},"modified":"2026-04-07T04:30:12","modified_gmt":"2026-04-07T04:30:12","slug":"media-queries","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/css\/lesson\/media-queries\/","title":{"rendered":"Media Queries"},"content":{"rendered":"\n<p>Introduction to Media Queries<br>Media Queries are a feature of CSS that allow you to apply styles based on the screen size, device type, or resolution. They are essential for creating responsive websites that work well on mobile phones, tablets, and desktops.<\/p>\n\n\n\n<p>Why Media Queries are Important<br>Media Queries help your website adapt to different screen sizes. Without them, a website may look good on a desktop but broken or hard to use on a mobile device. They improve user experience and make your design flexible and modern.<\/p>\n\n\n\n<p>Basic Syntax<br>A media query uses the @media rule followed by a condition.<\/p>\n\n\n\n<p>Example<br>@media (max width 600px)<br>body<br>font size 14px<\/p>\n\n\n\n<p>This means the styles will apply only when the screen width is 600 pixels or smaller.<\/p>\n\n\n\n<p>Common Types of Media Queries<\/p>\n\n\n\n<p>Max Width<br>Used when applying styles for smaller screens such as mobile devices.<\/p>\n\n\n\n<p>Example<br>@media (max width 768px)<br>container<br>width 100 percent<\/p>\n\n\n\n<p>Min Width<br>Used for larger screens like tablets or desktops.<\/p>\n\n\n\n<p>Example<br>@media (min width 768px)<br>container<br>width 750px<\/p>\n\n\n\n<p>Orientation<br>Used to detect whether the device is in portrait or landscape mode.<\/p>\n\n\n\n<p>Example<br>@media (orientation portrait)<br>body<br>background color lightblue<\/p>\n\n\n\n<p>Breakpoints in Responsive Design<br>Breakpoints are the screen sizes where your layout changes. Common breakpoints include 480px for mobile, 768px for tablets, and 1024px for desktops.<\/p>\n\n\n\n<p>Responsive Design with Media Queries<br>Media Queries allow you to adjust layouts, font sizes, images, and spacing based on screen size. For example, you can stack elements vertically on mobile and display them side by side on larger screens.<\/p>\n\n\n\n<p>Best Practices<\/p>\n\n\n\n<p>Use mobile first approach by designing for small screens first and then adding styles for larger screens<br>Keep your code simple and organized<br>Test your design on different devices and screen sizes<br>Use flexible layouts like Flexbox or Grid along with Media Queries<\/p>\n\n\n\n<p>Conclusion<br>Media Queries are a powerful tool in CSS that help create responsive and user friendly websites. Learning how to use them properly will improve your web design skills and ensure your websites look great on all devices.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"menu_order":0,"template":"","class_list":["post-131","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Media Queries - CSS learning mastery<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gigz.pk\/css\/lesson\/media-queries\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Media Queries - CSS learning mastery\" \/>\n<meta property=\"og:description\" content=\"Introduction to Media QueriesMedia Queries are a feature of CSS that allow you to apply styles based on the screen size, device type, or resolution. They are essential for creating responsive websites that work well on mobile phones, tablets, and desktops. Why Media Queries are ImportantMedia Queries help your website adapt to different screen sizes. [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/css\/lesson\/media-queries\/\" \/>\n<meta property=\"og:site_name\" content=\"CSS learning mastery\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-07T04:30:12+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/media-queries\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/media-queries\\\/\",\"name\":\"Media Queries - CSS learning mastery\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/#website\"},\"datePublished\":\"2026-04-07T04:30:10+00:00\",\"dateModified\":\"2026-04-07T04:30:12+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/media-queries\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/media-queries\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/lesson\\\/media-queries\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/css\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Media Queries\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/css\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/css\\\/\",\"name\":\"CSS learning mastery\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/css\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Media Queries - CSS learning mastery","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gigz.pk\/css\/lesson\/media-queries\/","og_locale":"en_US","og_type":"article","og_title":"Media Queries - CSS learning mastery","og_description":"Introduction to Media QueriesMedia Queries are a feature of CSS that allow you to apply styles based on the screen size, device type, or resolution. They are essential for creating responsive websites that work well on mobile phones, tablets, and desktops. Why Media Queries are ImportantMedia Queries help your website adapt to different screen sizes. [&hellip;]","og_url":"https:\/\/gigz.pk\/css\/lesson\/media-queries\/","og_site_name":"CSS learning mastery","article_modified_time":"2026-04-07T04:30:12+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/gigz.pk\/css\/lesson\/media-queries\/","url":"https:\/\/gigz.pk\/css\/lesson\/media-queries\/","name":"Media Queries - CSS learning mastery","isPartOf":{"@id":"https:\/\/gigz.pk\/css\/#website"},"datePublished":"2026-04-07T04:30:10+00:00","dateModified":"2026-04-07T04:30:12+00:00","breadcrumb":{"@id":"https:\/\/gigz.pk\/css\/lesson\/media-queries\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/css\/lesson\/media-queries\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/css\/lesson\/media-queries\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/css\/"},{"@type":"ListItem","position":2,"name":"Media Queries"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/css\/#website","url":"https:\/\/gigz.pk\/css\/","name":"CSS learning mastery","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/css\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/css\/wp-json\/wp\/v2\/lesson\/131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/css\/wp-json\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/css\/wp-json\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/css\/wp-json\/wp\/v2\/media?parent=131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}