Home >Web Front-end >CSS Tutorial >Media Attribute in HTML

Media Attribute in HTML

Susan Sarandon
Susan SarandonOriginal
2024-11-25 14:52:12705browse

Media Attribute in HTML

Syntax

  1. This will include styles.css only if the screen width is 600 pixels or less.
<link rel="stylesheet" href="styles.css" media="screen and (max-width: 600px)">

Possible Use-case

<link rel="stylesheet" href="desktop-styles.css" media="screen and (min-width: 1024px)">
<link rel="stylesheet" href="mobile-styles.css" media="screen and (max-width: 600px)">

It will help organize your code little bit.

The above is the detailed content of Media Attribute in HTML. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn