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

Media Attribute in HTML

Susan Sarandon
Release: 2024-11-25 14:52:12
Original
689 people have browsed it

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)">
Copy after login

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)">
Copy after login

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!

source:dev.to
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template