CSS screen Media Type

Beginner
⏱️ 7 min read
📚 Updated: Jul 2026
🎯 4 Examples
Media Queries

What You’ll Learn

The screen media type targets on-screen displays. It is the default for web browsers and the foundation of every responsive layout you build with media queries.

01

@media

Media query.

02

screen

On-screen.

03

min-width

Desktop up.

04

max-width

Mobile down.

05

vs print

Screen/paper.

06

default

Optional.

Introduction

When you open a website on your phone or laptop, the browser renders it on a screen — a continuous, scrollable display. CSS media queries let you target that medium specifically with @media screen.

Most responsive CSS you write already applies to screens. Adding the screen keyword makes that intent explicit and helps separate on-screen styles from print or other output types.

Definition and Usage

Write @media screen and (max-width: 600px) to apply rules only on screens 600 pixels wide or narrower. Combine with any media feature: min-width, orientation, resolution, and more.

💡
Beginner Tip

In everyday web development, @media (max-width: 768px) works the same as @media screen and (max-width: 768px) because browsers assume screen by default. Use screen explicitly when you also write @media print rules.

📝 Syntax

Use screen as the media type, then add features with and:

syntax.css
/* All screen devices */
@media screen {
  /* On-screen styles */
}

/* Screens 600px wide or narrower */
@media screen and (max-width: 600px) {
  /* Mobile screen styles */
}

/* Wide screens (desktop) */
@media screen and (min-width: 48rem) {
  /* Desktop screen styles */
}

Common Media Types

screen Monitors, phones, tablets — continuous on-screen display.
print Printed pages and print preview — paper output.
all Every media type — use sparingly for global rules.

Features You Can Combine

  • min-width / max-width — Viewport width breakpoints for responsive layout.
  • orientation — Portrait or landscape screen orientation.
  • resolution — Screen pixel density (Retina, high-DPI).
  • pointer / hover — Input capabilities on screen devices.

screen vs print

@media screen On-screen display — colors, navigation, interactive UI, animations.
@media print Printed output — hide nav, simplify layout, control page breaks.

screen vs omitting screen

@media screen and (max-width: 600px) Explicit — clearly targets screens only; won’t affect print.
@media (max-width: 600px) Implicit — browsers treat this as screen; fine for most projects.

Basic Example

screen-basic.css
body {
  background-color: #dbeafe;
}

@media screen and (max-width: 600px) {
  body {
    background-color: #fecaca;
  }
}

Default Value

There is no default media query. However, browsers treat normal stylesheets as screen media by default. Rules outside any @media block already apply to on-screen display.

Syntax Rules

  • Combine type and feature with and: @media screen and (min-width: 48rem).
  • Use commas for OR logic: @media screen and (max-width: 600px), print { }.
  • Do not call screen a CSS property — it is a media type.
  • Prefer rem or em for breakpoints when possible; px is fine for learning.
  • Pair screen rules with print rules when content appears in both mediums.

Related Topics

  • print — printed output media type
  • height — viewport height media feature
  • orientation — portrait and landscape queries
@media screen and (max-width: 600px) @media screen and (min-width: 48rem) @media screen and (orientation: landscape)

⚡ Quick Reference

QuestionAnswer
Media type namescreen
What it targetsOn-screen continuous display (monitors, phones, tablets)
Default in browsers?Yes — normal CSS assumes screen
Common pairingscreen and (min-width) or (max-width)
Opposite typeprint for paper output
Must you write it?Optional for screen-only sites; recommended with print styles
Browser supportUniversal — all browsers

When to Use screen

Reach for the screen media type when you need to distinguish on-screen styles from other output:

  • Responsive layouts — Combine with min-width / max-width breakpoints.
  • Screen-only UI — Navigation bars, modals, and tooltips that should not print.
  • Screen + print sites — Explicitly separate screen colors from print-friendly black-and-white.
  • Orientation layoutsscreen and (orientation: landscape) for tablets and phones.
  • Documentation clarity — Make intent obvious in code reviews and team style guides.

👀 Live Preview

Resize your browser window. This block is blue on wide screens and turns coral at 600px or narrower (@media screen and (max-width: 600px)):

Screen Width Demo Drag the window edge to see the breakpoint Wide: blue · 600px or less: coral

Examples Gallery

Practice screen with responsive backgrounds, desktop padding, landscape layout, and screen-only banners.

📜 Core Patterns

Build responsive on-screen styles with the screen media type.

Example 1 — Responsive background with max-width

Change the page background on narrow screens (600px or less):

screen-maxwidth.css
body {
  background-color: #dbeafe;
}

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

How It Works

The classic beginner responsive demo from the reference tutorial, with correct media type terminology and explicit screen keyword.

Example 2 — Desktop layout with min-width

Add more padding and larger text on wide screens:

screen-minwidth.css
.content {
  padding: 1rem;
  font-size: 1rem;
}

@media screen and (min-width: 48rem) {
  .content {
    padding: 2rem;
    font-size: 1.125rem;
  }
}
Try It Yourself

How It Works

Mobile-first designs start with compact styles, then use min-width to enhance the layout as the screen grows.

Example 3 — Landscape two-column layout

Switch to a side-by-side grid when the screen is in landscape:

screen-orientation.css
.layout {
  display: grid;
  gap: 0.75rem;
}

@media screen and (orientation: landscape) {
  .layout {
    grid-template-columns: 1fr 1fr;
  }
}
Try It Yourself

How It Works

Combining screen with orientation targets on-screen landscape mode without affecting printed pages.

Example 4 — Screen-only banner (hide when printing)

Show a banner on screen but hide it in print preview:

screen-print.css
.screen-banner {
  padding: 0.75rem 1rem;
  background: #3b82f6;
  color: #fff;
}

@media print {
  .screen-banner {
    display: none;
  }
}
Try It Yourself

How It Works

Understanding screen means knowing what isn’t screen. Hiding UI chrome with @media print keeps printed articles clean.

🛠 Usage Tips

  • Mobile-first — Start with base styles, add screen and (min-width: …) for larger screens.
  • Explicit with print — When you have print styles, write screen on screen-only rules for clarity.
  • Use rem breakpoints48rem scales with user font-size preferences better than fixed pixels.
  • Test by resizing — Drag the browser window to verify max-width breakpoints.
  • Combine featuresscreen and (min-width: 48rem) and (orientation: landscape) for precise targeting.

⚠️ Common Pitfalls

  • Calling it a propertyscreen is a media type, not a CSS property.
  • Missing and — Write @media screen and (max-width: 600px), not @media screen (max-width: 600px).
  • Confusing type with featurescreen is the medium; min-width is the condition.
  • Only max-width — Don’t forget min-width for desktop-first enhancements.
  • Forgetting print — Screen-only banners and dark backgrounds may waste ink when printed.

♿ Accessibility

  • Zoom-friendly breakpoints — Use relative units so layouts adapt when users zoom text.
  • Do not hide content — Responsive breakpoints should reflow content, not remove essential information.
  • Touch targets on small screens — Screen mobile styles need large enough buttons and links.
  • Contrast on all sizes — Color changes at breakpoints must maintain readable contrast.
  • Motion preferences — Combine screen queries with prefers-reduced-motion for animations.

🧠 How screen Works

1

Browser detects output medium

Identifies whether content renders on a screen or is being printed.

Detect
2

screen type is matched

Rules inside @media screen qualify for on-screen display.

Match
3

Media features are evaluated

Width, orientation, and other conditions are checked with and.

Evaluate
=

Responsive on every screen

Layout adapts to viewport size on phones, tablets, and desktops.

🖥 Browser Compatibility

The screen media type is supported in all browsers. It has been a core part of CSS since media queries were introduced.

Baseline · Universal support

Screen media queries

Works in Chrome, Firefox, Safari, Edge, Opera, and all mobile browsers.

100% Global support
screen media type 100% supported

Bottom line: @media screen is production-ready and the backbone of responsive web design.

🎉 Conclusion

The screen media type targets on-screen displays — the medium where nearly all web browsing happens. Combine it with min-width, max-width, and other features to build responsive layouts that adapt from phones to desktops.

Browsers default to screen, so the keyword is often optional. Use it explicitly when you also style for print and want clear, maintainable separation between screen and paper output.

💡 Best Practices

✅ Do

  • Use screen and (min-width)
  • Write print rules too
  • Test by resizing
  • Prefer rem breakpoints
  • Mobile-first base styles

❌ Don’t

  • Call it a property
  • Skip the and keyword
  • Hide essential content
  • Only use max-width
  • Ignore print output

Key Takeaways

Knowledge Unlocked

Five things to remember about screen

Use these points when building responsive on-screen layouts.

5
Core concepts
def 02

Default

In browsers.

Behavior
and 03

and (width)

Combine.

Syntax
prt 04

vs print

Screen/paper.

Compare
% 05

100%

Supported.

Support

❓ Frequently Asked Questions

What does the CSS screen media type do?

The screen media type targets continuous on-screen presentation — monitors, laptops, tablets, and phones. Rules inside @media screen { } apply when content is displayed on a screen, not when printed.

Is screen a media type or a media feature?

screen is a media type — it describes the output medium (a display). Features like min-width, orientation, and resolution describe device capabilities. Combine them: @media screen and (max-width: 600px) { }.

Do I need to write screen in every media query?

Usually no. Browsers default to screen for normal stylesheets. @media (max-width: 768px) behaves the same as @media screen and (max-width: 768px) on the web. Use screen explicitly when you want to separate screen rules from print or other media types.

How do I build responsive layouts with screen?

Combine screen with width features: @media screen and (min-width: 48rem) for desktop, @media screen and (max-width: 37.5rem) for mobile. Mobile-first designs often use min-width breakpoints that layer styles as the viewport grows.

Is @media screen widely supported in browsers?

Yes. The screen media type has been supported in all browsers for decades. It is the foundation of responsive web design alongside width-based media features.

Practice in the Live Editor

Open the HTML editor and experiment with @media screen and (max-width: 600px) breakpoints.

HTML Editor →

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.

5 people found this page helpful