How to Target Desktop, Tablet & Mobile using Media Query and Breakpoints
On This Page What is Media Query and Breakpoints?April 26, 2026 · 14 min read · Mobile Testing
Websites must effortlessly adapt to screens of all sizes, from desktops and tablets to smartphones. are the foundation of antiphonal web design which allows developers to create flexible layouts that adjust based on device characteristic. What is Media Query and Breakpoints? Media query for background, tablet and mobile Desktop media question are CSS pattern that apply styles specifically to screens with widths typically 1024px or larger, allow websites to adjust layout and design for optimal viewing on background and laptop devices. This article explores how to write efficient media inquiry for desktop, tablet, and mobile layouts, along with common breakpoints, best practices, and testing bakshis for truly responsive designing. Media query is used to create a. The main purpose of antiphonal web design is to develop a clear view of a website on different gadgets. There should be no damage /breakage to the visibility of web content for different screen sizes. This is the reason you require a Breakpoint to prevent your webpage from malfunctioning. Breakpoints specify how much screen firmness and width are locomote to deform the view for what twist. So, it is a pixel value for the blind. The Breakpoint is also called. Example:The BrowserStack Home Page must be clearly visible on your laptop/desktop and as well as mobile without any matter. Media Query is used to sustain the Breakpoint of the website and is written in CSS language. Also, we can use HTML, JavaScript, and many more for creating media queries. Media query can be used to ascertain these properties: Chrome DevTools cater a Media Query Inspector to inspect and trigger breakpoints within a page which will be explained in the following sections Media enquiry tab which media is desirable for which. A media character ex. Print, screen etc., reveal this thing to the browser. Here are the different media types listed below– You have to pass a convention or test called Media Expression by the CSS code for which it is applied. If the media case is right and the test turn successful, then a set of CSS pattern should be applied. Read More: Breakpoint and medium inquiry are dependent on each early. Media query simply shows the value of the Breakpoint. So, you can say a breakpoint is a medium query. We use breakpoints to view and read web content easily. Breakpoint prevents a paragraph, schoolbook or image from any visibility deformation. It assigns both increasing and decreasing screen size. Due to the change in screen sizes, the content becomes hard to see and read. In that case, you must hold to utilise a standard to stop the disruption. Here is the standard responsive breakpoints list, used across mobile, background, and tablet: Follow-Up Read:? Mobile-first and desktop-firstare two different coming to structuring your responsive CSS use medium enquiry: In this approach, you write your base mode for little screens (typically mobile devices), and so usemin-widthmedia queries to increasingly raise the design for large screens like tablets and desktops. Example: css Best for execution and future-proofing, as it ensures mobile users receive minimal CSS first. Here, your base styles target larger blind (desktops), and you usemax-widthmedia interrogation to adjust the layout for modest screens like tablets and phones. Example: css Utilitarian when the master hearing utilise background, or if the desktop layout is more complex. Here are the key differences between having a mobile-first and desktop-first strategy using CSS: Media queries for background blind are used to apply CSS styles specifically when the viewport width reaches a typical background resolution. This allows you to adjust layout, font sizes, and component behavior for users on larger screens. Use max-widthif following a desktop-first approaching: css These breakpoints can alter based on your layout or analytics, but 1024px is generally theminimum width for desktop targeting. Example Usage css Tablets fall between nomadic phones and desktops in screen size, typically ranging from600px to 1024pxin width. Crafting CSS rules specifically for tablets ensures your layout remains user-friendly and visually consistent across these mid-sized device. Pro tip: Tools like SUSA can handle this autonomously — upload your app and get results without writing a single test script. You can adjust these values based on your design system and analytics information. Mobile-first (habituatemin-width and max-width): css Desktop-first (habituate only max-width): css Implementing a is more challenging as they experience small screen sizes. Another challenge is create the background aspect on a wandering screen. Thus, software developers use Mobile-First Approach to create a antiphonal site for mobile. Bootstrap is a well-known framework for highly mobile responsive web design because it can resize all screen size in a good way. Syntax: CSS with media query for mobile-first coming: Also Read: ? You can start discussing with our dissension community A permission and delivers a style sheet for various screen sizes and resolutions for different device. But before applying a style sheet, the associated medium query needs to turn true for that media, and then the sheet becomes applicable. Note: Media query contains @ media regulation, which include a cube of CSS properties. This rule is habituate when a sure condition go true. These conditions are several media feature like width (max-width, min-width), height, color, grid, aspect ratio, resolve, orientation, etc. Screen resolutions help to trim friction, and it cause best results for responsive web design. Screen resolutions for different devices are listed below: There are some other aspects for clash cutting which are: Read More: Call-to-action (CTA) elements play a critical purpose in user engagement, and using medium inquiry ensures they continue visible, approachable, and clickable across all device sizes—whether adapting a non-responsive CTA or enhancing a responsive one. Here is an example of how to apply media query for non-responsive and responsive CTA: Note: The output becomes a Sign me up! CSS media queries countenance you to tailor your website ’ s layout and styling to different screen widths, enabling a antiphonal design that adapts seamlessly to mobile, pad, and desktop devices. Read More: Breakpoints are the screen widths at which your website layout should change to cater an optimum viewing experience. These values act as general guidepost and can be align based on your design need. Standard Device Breakpoints Writing effective media inquiry goes beyond targeting device widths. Good media queries ascertainmaintainability, execution, and design consistencyacross devices. Here are key better practices: 1. Use Mobile-First with min-width Start with bag styles for mobile and bed on styles for larger device using min-width. This improves load performance and aligns with mod browsing use. css Read More: 2. Avoid Targeting Specific Devices Don & # 8217; t indite queries like@ media (device-width: 375px).Devices change wide, so base breakpoints on content layout postulate instead of device name. 3. Keep Breakpoints Meaningful Choose breakpoints based onwhere your design breaks, not arbitrary number. Use design-driven breakpoints such as: css 4. Use Relative Units (em, rem) Instead of pixels, use relative unit for breakpoints. This ensures your media queries respond to user zoom and base font settings. css 5. Organize Media Queries Logically Group your media queries bycomponentinstead of scattering them. You can either: 6. Avoid Overlapping Ranges Ensure there ’ s no overlap or gap between your breakpoints. For instance: css 7. Test Across Real Devices Always test how your media queries behave on genuine devices, not simply browser emulators. Tools likeBrowserStack Liveallow existent device testing to get edge cause. 8. Use Logical Combinations When Needed Combine multiple conditions (for example, width and orientation) for finer control: css 9. Avoid Too Many Breakpoints More breakpoints means harder maintenance. Stick to 3 to 5 well-placed breakpoints based on real layout needs. has a characteristic to trigger a media query breakpoint without resizing a browser viewport manually. You can do this by using the Media inquiry Inspector, it likewise inspects a breakpoint. The operation is quite simple. The breakpoints become trigger by clicking on horizontal barroom. Sample query: This is a sample media query with CSS. Adding and media queries improves the overall user experience of a website. Moreover, it makes the website leisurely to voyage, which helps visitors to find the particular they are looking for. As a result, the website ranks better on the SERP, and the increased gimmick compatibility further enhance the outlook of the website. Hopefully, this quick guide has shed ample light on the concepts of media queries and breakpoints and how they help to examine responsive web designs on desktops, tablet and mobile. aid in testing reactive web pattern with media queries and breakpoints. Once a website has been designed and breakpoints comprise, quiz them on real devices for their reactivity. Depending on the number of screen sizing in question, insure responsive design is easiest when using a. On This Page # Ask-and-Contributeabout this topic with our Discord community. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.How to Target Desktop, Tablet & amp; Mobile using Media Query and Breakpoints
Overview
What is Media Query and Breakpoints?
What kind of Testing is performed by Media Queries?
When is a Breakpoint Added?
Mobile-first vs Desktop-first Media Queries
Mobile-first
/ * Base styles for mobile * / body {font-size: 14px;} / * Tablet and up * / @ media (min-width: 768px) {body {font-size: 16px;}} / * Desktop and up * / @ media (min-width: 1024px) {body {font-size: 18px;}}Desktop-first
/ * Base styles for background * / body {font-size: 18px;} / * Tablet and below * / @ media (max-width: 1024px) {body {font-size: 16px;}} / * Mobile * / @ media (max-width: 767px) {body {font-size: 14px;}}Feature Mobile-First Desktop-First Default CSS Targets Mobile / pocket-size screens Desktop / large screen Media Query Type min-width max-width Philosophy Reformist Enhancement Graceful Degradation Performance Focus Faster loading for roving devices Optimized for powerful devices Future-Proofing More aligned with modern usage More suitable to legacy covering Media Query for Desktop
Syntax for Desktop Media Query
/ * Base background mode * / @ media (max-width: 1024px) {/ * Adjustments for tablet and below * /}Common Desktop Breakpoints
Device Type Min Width (px) Pocket-size Desktop 1024px Standard Desktop 1280px Large Desktop 1440px–1920px / * Desktop layout with sidebar and wider content * / @ media (min-width: 1280px) {.main-content {display: flex; gap: 20px;} .sidebar {breadth: 300px; display: block;}}Best Practices to postdate when using Media Query for Desktop
Media Query for Tablet
Mutual Tablet Breakpoints
Device Type Screen Width (px) Small Tablet 600px – 767px Standard Tablet 768px – 1023px Media Query Syntax for Tablets
@ medium (min-width: 768px) and (max-width: 1023px) {/ * Styles for tablets * / .grid-layout {grid-template-columns: 1fr 1fr;}}@ media (max-width: 1023px) {/ * Adjust layout for tablet and smaller * / .sidebar {presentation: none;}}Use Cases for Tablet Media Queries
Best Practices for Tablet Media Query
Media Query for Mobile
@ medium (min-width: 640px) {// CSS belongings}* Initial layout for desktop first * / * {box-sizing: border-box; font-family: `` Mukta '', sans-serif; color: rgb (10, 146, 10);} main {overflow-y: scroll; elevation: 100vh; cushioning: 40px;} body {margin: 0; display: grid; grid-template-rows: 260px 1fr; max-height: 100vh; overflow: hidden;} h1 {margin-top: 0; font-size: 24px; line-height: 1; text-transform: capital; margin-bottom: 12px;} p {border: 0; font-size: 16px; font-weight: 300;} section {display: flex; flex-direction: column; justify-content: center; align-items: center; / * display: cube; * / margin-left: 7vw; border-bottom: solid 1px # dbdce1; border-right: none; align-items: center;} section img {border-radius: 50 %; width: 150px;} .projects img {width: 100 %;} .projects {margin-top: 32px; display: grid; grid-template-columns: repeat (1, 1fr); gap: 30px; align-items: center;} / * Media Queries * / @ medium (min-width: 640px) {.projects {grid-template-columns: repetition (2, 1fr); gap: 40px;}} @ media (min-width: 768px) {.projects {grid-template-columns: repetition (3, 1fr); gap: 50px;} h1 {font-size: 40px;} p {font-size: 18px;}} @ media (min-width: 1024px) {.projects {grid-template-columns: repeat (4, 1fr); gap: 60px;}} @ medium (min-width: 640px) and (orientation: landscape) {body {grid-template-columns: 160px 1fr; grid-template-rows: none;} subdivision {border-bottom: none; margin-left: -4px; border-right: solid 1px # dbdce1;} section img {width: 140px;}}Like what you are reading?
Media Query Resolution for All Devices
Devices Resolutions Smartphone max-width 480px Low declaration Tablets and iPads 767px Tablet iPads portrait mode max-width 1024px Desktop max-width 1280px Huge size screen 1281px and greater Media query for Non-Responsive and Responsive CTA:
/ * General CSS * / html {font-family: `` Helvetica Neue '', Helvetica, Arial;} body {font-size: calc (1.2em + 0.5vw);} h1 {font-size: 1.25em; font-weight: normal;} hr {width: 40 %; margin-top: 1.5em; margin-bottom: 1em; margin-right: 100 %;} / * Button Styling * / .non-resp {display: block; height: 6.25rem; width: 30rem; background: # 606060; color: # ffffff; text-align: center; font-weight: bold; font-size: 3rem; line-height: 6.25rem; font-family: Arial; border-radius: 20px; text-decoration: none;} .resp {presentation: block; height: 18vh; line-height: 18vh; breadth: 34.5vw; min-width: 200px; background: # 606060; colouration: # ffffff; text-align: center; font-size: 1.5em; font-weight: bold; font-family: Arial; border-radius: 20px; text-decoration: none; cushioning: 2px 5px;} .resp: hover, .non-resp: hover {opacity: 80 %;} @ media (min-width: 50em) {.resp {font-size: 5vw;}}CSS Media Query for assorted Device-width Responsive Web Design
& lt;! DOCTYPE html & gt; & lt; html & gt; & lt; caput & gt; & lt; title & gt; CSS media query & lt; /title & gt; & lt; style & gt; body {text-align: eye;} .gfg {font-size: 40px; font-weight: bold; color: green;} @ media blind and (max-width:800px) {body {text-align: heart; background-color: park;} .gfg {font-size: 30px; font-weight: bold; color: white;} .geeks {color: white;}} @ medium screen and (max-width:500px) {body {text-align: centre; background-color: blueness;}} & lt; /style & gt; & lt; /head & gt; & lt; body & gt; & lt; div & gt; ComputerEasySchool & lt; /div & gt; & lt; div & gt; A reckoner skill portal for kids & lt; /div & gt; & lt; /body & gt; & lt; /html & gt;Common Media Query Breakpoints for Mobile, Tablet, and Desktop
Device Type Breakpoint Range (px) Suggested Media Query Mobile (Small) 0 – 479 @ media (max-width: 479px) Mobile (Large) 480 – 767 @ medium (min-width: 480px) and (max-width: 767px) Tablet (Portrait) 768 – 899 @ media (min-width: 768px) and (max-width: 899px) Tablet (Landscape) 900 – 1023 @ media (min-width: 900px) and (max-width: 1023px) Desktop (Small) 1024 – 1279 @ media (min-width: 1024px) and (max-width: 1279px) Desktop (Medium) 1280 – 1439 @ media (min-width: 1280px) and (max-width: 1439px) Desktop (Large) 1440 and above @ medium (min-width: 1440px) Best Practices for Writing Media Queries
/ * Base title for mobile * / .container {padding: 10px;} / * Adjust for tablets and larger screens * / @ media (min-width: 768px) {.container {padding: 20px;}}@ media (min-width: 640px) {...} / * small pad * / @ media (min-width: 768px) {...} / * tablets * / @ medium (min-width: 1024px) {...} / * desktops * /@ medium (min-width: 48em) {/ * Scales with user 's settings * /}@ media (max-width: 767px) {...} @ media (min-width: 768px) {...}@ media (min-width: 768px) and (orientation: portrait) {...}Media Query Testing Tool
@ media only screen and (min-device-width: 320px) and (max-device-width:480px) {header {/ * Extra style * /}}Conclusion
Related Guides
Automate This With SUSA
Test Your App Autonomously