Rel (HTML 속성)

Lisa Kudrow
Lisa Kudrow원래의
2025-02-27 10:09:16815검색
<code class="language-html"><!DOCTYPE html>


    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Understanding the HTML rel Attribute</title>



<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">
</code>
속성의 사용에 유의하십시오. 이 텍스트는 브라우저의 스타일 시트 선택 메뉴에 나타납니다 (사용 가능한 경우).

브라우저 메뉴의 스타일 시트 제목의 예 > rss/atom feeds title 속성은 RSS 또는 원자 피드와 같은 대체 컨텐츠 형식에도 링크하는 데 사용됩니다.

favicons favicon (웹 사이트 아이콘)을 지정하려면 : 를 사용하십시오

위 내용은 Rel (HTML 속성)의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.