CSS screen Media Type

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The screen media type targets on-screen presentation—monitors, laptops, tablets, and phones. Use it inside @media when styles should apply on a display, not when printing.

It is a media type (the broad output category), not a media feature. Combine it with features such as width for responsive layouts: @media screen and (max-width: 600px).

Deprecated Old media types

Types such as tty, tv, projection, handheld, braille, embossed, and aural are deprecated in Media Queries Level 4—do not use them. Prefer screen, print, and all plus media features.

Note Type is often optional

If you omit the media type, all is implied. Write screen when you need to exclude print (or other types) clearly.

CSS Syntax

syntax.css
@media screen | only screen | screen and (feature) | screen, print { … }

Join a type to features with and. Separate multiple types with commas (logical OR).

Media Types

Type / patternDescriptionTry it
screenIntended primarily for screensTry it
screen and (…)Screen plus a feature (for example max-width)Try it
printPaged material and print previewTry it
screen, printSame rules for both screen and printTry it
allSuitable for all devices (default when type is omitted)Try it

How to Use screen

Use screen to scope display styles, then layer width or other features for breakpoints.

  1. Write base styles that work on a normal screen.
  2. Add @media screen { … } when rules must not apply in print.
  3. Combine with features: @media screen and (max-width: 600px).
  4. Use @media print for printer-only tweaks (hide nav, adjust fonts).
PieceRequired?Role
@mediaYesWraps the media query
screenOptional*Limits the block to on-screen media
Media featureOptionalWidth, orientation, resolution, and so on
and / ,As neededCombine features, or OR multiple queries

*Required when you use only, or when you need to exclude print.

Live Preview

On a normal browser tab, screen matches and print does not. Open print preview to see the print styles take over. Recheck reports matchMedia results.

Detected media types

Blue sample = @media screen matched. Dashed gray appears under @media print.

Screen detection

Screen / print sample

screen print

Checking…

CSS Examples

Each snippet focuses on the screen media type. Use Try It Yourself for a live editor.

Example 1 — Basic @media screen

Apply styles only when the output is a screen.

CSS
p {
  background: #e2e8f0;
}

@media screen {
  p {
    background: #dbeafe;
  }
}
Try It Yourself

How It Works

  1. Set a default. Gray background works as a fallback.
  2. Add the type. @media screen scopes the next rules.
  3. Enhance on display. Blue background applies when viewing on a screen.
  4. Skip print. Those rules do not apply in print preview.

Example 2 — Screen + max-width

Combine the media type with a width feature for a simple breakpoint.

CSS
p {
  background: #dbeafe;
}

@media screen and (max-width: 600px) {
  p {
    background: #fecaca;
  }
}
Try It Yourself

How It Works

  1. Start wide. Blue background is the default on screen.
  2. Join with and. Both the type and the feature must match.
  3. Test width. (max-width: 600px) is true on narrow viewports.
  4. Swap color. Coral marks the mobile breakpoint.

Example 3 — Screen vs Print

Give screen and print different font sizes (MDN pattern).

CSS
@media screen {
  body {
    font-size: 16px;
  }
}

@media print {
  body {
    font-size: 12pt;
  }
}
Try It Yourself

How It Works

  1. Split by type. Two @media blocks target different media.
  2. Screen uses px. Comfortable reading size on displays.
  3. Print uses pt. Print-friendly sizing for paper.
  4. One active at a time. The browser picks the matching type.

Edge Cases & Pitfalls

Small details that change how screen queries behave.

type vs feature

Not the same as width

screen names the medium. Responsive breakpoints still need features like width.

omit

Omitting the type means all

@media (max-width: 600px) can apply in print too. Add screen if print should stay unaffected.

only

only needs a type

Write only screen and (max-width: 600px). Do not use only without a media type.

legacy

Skip deprecated types

Do not use handheld, tv, or similar. Prefer features such as pointer or scan.

a11y

Prefer em in breakpoints

Length features work better with em when users enlarge text, so breakpoints scale with font size.

Browser Support

screen is a browser media type. Node.js, Deno, and Bun do not evaluate it.

✓ Baseline · Widely available

screen

Supported in all major browsers for decades. It is a foundation of responsive CSS alongside width-based features.

99% All modern browsers
Google Chrome All
Full
Mozilla Firefox All
Full
Apple Safari All
Full
Microsoft Edge All
Full
Opera All
Full
Samsung Internet All
Full
Internet Explorer All
Full
@media screen Universally supported

Bottom line: Safe for production. Use screen to separate display styles from print; pair with features for responsive layouts.

Key Takeaways

  • Role: target on-screen displays with @media screen.
  • Pair: screen and (feature) for breakpoints; print for paper.
  • Default: omitting the type implies all.
  • Tip: avoid deprecated types; use modern media features instead.

One line: screen names the display medium—add features for responsive behavior, and use print for paper.

Frequently Asked Questions

It targets continuous on-screen presentation—monitors, laptops, tablets, and phones. Rules inside @media screen { } apply on a display, not when printing.
screen is a media type (the output medium). Features like max-width or orientation describe capabilities. Combine them: @media screen and (max-width: 600px) { }.
Usually no. If you omit the type, all is implied. Write screen explicitly when you want to keep screen rules separate from print.
screen is for displays. print is for paged output and print preview. Use each type for different fonts, colors, and layout.
only requires the whole query to match and historically stopped older browsers from treating screen and (feature) as just screen. You must pair only with a media type.
No. It is a CSS media type evaluated by the browser, not a Node.js or server runtime feature.

Next: scripting

Learn how to detect JavaScript availability with a media feature.

scripting tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful