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

How to Target Desktop, Tablet & amp; Mobile using Media Query and Breakpoints

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.

Overview

What is Media Query and Breakpoints?

  • Media Queriesenable responsive web design by applying CSS rules found on gimmick characteristic like width, height, orientation, and resolution.
  • Breakpointsare specific screen widths where the layout correct to supply optimal viewing across device.

Media query for background, tablet and mobile

  • Media query for background:Targets screens typically 1024px and above to apply styles optimized for big displays.
  • Media query for tablet:Applies styles to screen between 768px and 1023px, covering most tablet devices.
  • Media query for mobile:Targets screens below 768px, ensuring layout are mobile-friendly and touch-optimized.

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.

What is Media Query and Breakpoints?

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:

  • Width and tallness of the viewport
  • Width and height of the device
  • Orientation
  • Resolution

Chrome DevTools cater a Media Query Inspector to inspect and trigger breakpoints within a page which will be explained in the following sections

What kind of Testing is performed by Media Queries?

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

  • All: Using all media devices.
  • Print: Using printers.
  • Screen: For computer screens, smartphones, pad etc.
  • Speech: For screen reader.

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:

When is a Breakpoint Added?

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:

  • 1920×1080 (8.89 %)
  • 1366×768 (8.44 %)
  • 360×640 (7.28 %)
  • 414×896 (4.58 %)
  • 1536×864 (3.88 %)
  • 375×667 (3.75 %)

Follow-Up Read:?

Mobile-first vs Desktop-first Media Queries

Mobile-first and desktop-firstare two different coming to structuring your responsive CSS use medium enquiry:

Mobile-first

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

/ * 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;}}

Best for execution and future-proofing, as it ensures mobile users receive minimal CSS first.

Desktop-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

/ * 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;}}

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:

FeatureMobile-FirstDesktop-First
Default CSS TargetsMobile / pocket-size screensDesktop / large screen
Media Query Typemin-widthmax-width
PhilosophyReformist EnhancementGraceful Degradation
Performance FocusFaster loading for roving devicesOptimized for powerful devices
Future-ProofingMore aligned with modern usageMore suitable to legacy covering

 

Talk to an Expert

Media Query for Desktop

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.

Syntax for Desktop Media Query

Use max-widthif following a desktop-first approaching:

css

/ * Base background mode * / @ media (max-width: 1024px) {/ * Adjustments for tablet and below * /}

Common Desktop Breakpoints

Device TypeMin Width (px)
Pocket-size Desktop1024px
Standard Desktop1280px
Large Desktop1440px–1920px

 

These breakpoints can alter based on your layout or analytics, but 1024px is generally theminimum width for desktop targeting.

Example Usage

css

/ * 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

  • Use max-widthfor desktop-first designs: Start with styles for big screens (desktop) and usemax-widthmedia queries to align for tablets and mobile devices.
  • Avoid hardcoding to specific devices: Use breakpoints based on content needs, not device names.
  • Test on multiple blind sizes: Use real twist testing tool or BrowserStack to ensure consistency across resolutions.
  • Keep layout fluid: Combine medium inquiry with flexible grids and percentage widths for better scaling.
  • Group link rules: Keep all desktop-related queries together to preserve clean, maintainable CSS.

Media Query for Tablet

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.

Mutual Tablet Breakpoints

Device TypeScreen Width (px)
Small Tablet600px – 767px
Standard Tablet768px – 1023px

You can adjust these values based on your design system and analytics information.

Media Query Syntax for Tablets

Mobile-first (habituatemin-width and max-width):

css

@ medium (min-width: 768px) and (max-width: 1023px) {/ * Styles for tablets * / .grid-layout {grid-template-columns: 1fr 1fr;}}

Desktop-first (habituate only max-width):

css

@ media (max-width: 1023px) {/ * Adjust layout for tablet and smaller * / .sidebar {presentation: none;}}

Use Cases for Tablet Media Queries

  • Rearranging grid or flexbox columns into fewer columns
  • Increasing baptistry sizing for legibility
  • Making touch targets big
  • Hiding less relevant content like sidebars

Best Practices for Tablet Media Query

  • Don ’ t assume all tablets are used in landscape mode. Also supportportrait and landscape orientations.
  • Use min-width + max-widthranges to avoid overlap with peregrine or desktop styles.
  • Test on existent devicesespecially for iPads and Android pad with varying resolutions.

Media Query for Mobile

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.

  • In this approach, the CSS code is written for mobile view.
  • Min-width medium queries and landscape orientation are applicable to this coming.
  • Later, the CSS code can be embed with a media enquiry for increasing width, and additional prerequisite can be added for background users.

Bootstrap is a well-known framework for highly mobile responsive web design because it can resize all screen size in a good way.

Syntax:

@ medium (min-width: 640px) {// CSS belongings}

CSS with media query for mobile-first coming:

* 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;}}

Also Read: ?

Like what you are reading?

You can start discussing with our dissension community

Media Query Resolution for All Devices

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:

DevicesResolutions
Smartphone max-width480px
Low declaration Tablets and iPads767px
Tablet iPads portrait mode max-width1024px
Desktop max-width1280px
Huge size screen1281px and greater

There are some other aspects for clash cutting which are:

  • Give preference to the vital card options.
  • Avoid visual distractions.
  • Remove unnecessary battleground.
  • Concentrate on fluidity of search and filter options.
  • Highlight the significant CTA (Call to Action). It is a text constituent which indicates to take an action for the user. Ex. buy a ware, sign up for a free trial subscription newsletter, leave a comment etc.

Read More:

Media query for Non-Responsive and Responsive CTA:

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:

/ * 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;}}

Note: The output becomes a Sign me up!

CSS Media Query for assorted Device-width Responsive Web Design

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.

& 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;

Read More:

Common Media Query Breakpoints for Mobile, Tablet, and Desktop

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

Device TypeBreakpoint 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

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

/ * Base title for mobile * / .container {padding: 10px;} / * Adjust for tablets and larger screens * / @ media (min-width: 768px) {.container {padding: 20px;}}

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

@ media (min-width: 640px) {...} / * small pad * / @ media (min-width: 768px) {...} / * tablets * / @ medium (min-width: 1024px) {...} / * desktops * /

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

@ medium (min-width: 48em) {/ * Scales with user 's settings * /}

5. Organize Media Queries Logically

Group your media queries bycomponentinstead of scattering them. You can either:

  • Inline queries with element (modular CSS or SCSS)
  • Or group them at the bum, consistently across files.

6. Avoid Overlapping Ranges

Ensure there ’ s no overlap or gap between your breakpoints. For instance:

css

@ media (max-width: 767px) {...} @ media (min-width: 768px) {...}

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

@ media (min-width: 768px) and (orientation: portrait) {...}

9. Avoid Too Many Breakpoints

More breakpoints means harder maintenance. Stick to 3 to 5 well-placed breakpoints based on real layout needs.

Media Query Testing Tool

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.

  1. The initial stage implies activating the Device toolbar.
  2. Then ensure the Show media question alternative is enable.
  3. Finally, you can tick on different horizontal bars. They represent different media enquiry (or, you can say, registered media queries).

The breakpoints become trigger by clicking on horizontal barroom.

Sample query:

This is a sample media query with CSS.

@ media only screen and (min-device-width: 320px) and (max-device-width:480px) {header {/ * Extra style * /}}

Conclusion

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.

Tags
71,000+ Views

# Ask-and-Contributeabout this topic with our Discord community.

Related Guides

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free