<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Understanding the HTML rel Attribute</title> </head> <body> <h1>The `rel` Attribute: Defining Relationships in HTML</h1> <p>The <code>rel</code> attribute specifies the relationship between the current document and the linked resource. It's primarily used with the <code><link></code> and <code><a></code> tags to provide context and meaning to links.</p> <h2>Common Uses of the `rel` Attribute</h2> <h3>Stylesheets</h3> <p>The most common use is linking stylesheets: <code><link rel="stylesheet" href="styles.css"></code>. This clearly indicates the linked file is a stylesheet.</p> <h3>Alternate Stylesheets</h3> <p>You can define multiple stylesheets using <code>rel="alternate stylesheet"</code>. However, browser support for easily switching between these is limited. A JavaScript-based solution is often necessary for user selection.</p> <pre class="brush:php;toolbar:false"><code> <link href="main.css" media="screen" rel="stylesheet" type="text/css"> <link rel="alternate stylesheet" title="Higher Contrast" href="contrast.css" type="text/css" media="screen"> <link rel="alternate stylesheet" title="Gratuitous CSS" href="hot.css" type="text/css" media="screen">
title
<🎜 🎜> 속성은 RSS 또는 원자 피드와 같은 대체 컨텐츠 형식에도 링크하는 데 사용됩니다.
rel="alternate"
이 섹션은`rel` 속성에 대한 일반적인 질문에 답할 것입니다.
<code> <link rel="alternate" type="application/rss+xml" href="/rss.xml" title="RSS 2.0"> <link rel="alternate" type="application/atom+xml" href="/atom.xml" title="Atom 1.0"> </code>
rel="shortcut icon"
<🎜 🎜>와 유사하게, 하이퍼 링크에 의미 적 의미를 추가합니다 (예를 들어, <🎜 🎜>).
<code> <link href="/favicon.ico" rel="shortcut icon"> </code>
rel="next"
rel="prev"
위 내용은 Rel (HTML 속성)의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!