علامة <link> HTML
مثال
ارتباط بورقة أنماط خارجية:
<head>
<link rel="stylesheet" href="styles.css">
</head>
التعريف والاستخدام
تحدد العلامة <link>
العلاقة بين المستند الحالي والمورد الخارجي.
غالبًا ما يتم <link>
استخدام العلامة للارتباط بأوراق أنماط خارجية أو لإضافة رمز مفضل إلى موقع الويب الخاص بك.
العنصر <link>
هو عنصر فارغ يحتوي على سمات فقط.
دعم المتصفح
Element | |||||
---|---|---|---|---|---|
<link> | Yes | Yes | Yes | Yes | Yes |
صفات
Attribute | Value | Description |
---|---|---|
crossorigin | anonymous use-credentials |
Specifies how the element handles cross-origin requests |
href | URL | Specifies the location of the linked document |
hreflang | language_code | Specifies the language of the text in the linked document |
media | media_query | Specifies on what device the linked document will be displayed |
referrerpolicy | no-referrer no-referrer-when-downgrade origin origin-when-cross-origin unsafe-url |
Specifies which referrer to use when fetching the resource |
rel | alternate author dns-prefetch help icon license next pingback preconnect prefetch preload prerender prev search stylesheet |
Required. Specifies the relationship between the current document and the linked document |
sizes | HeightxWidth any |
Specifies the size of the linked resource. Only for rel="icon" |
title | Defines a preferred or an alternate stylesheet | |
type | media_type | Specifies the media type of the linked document |
السمات العالمية
تدعم <link>
العلامة أيضًا السمات العامة في HTML .
سمات الحدث
تدعم <link>
العلامة أيضًا سمات الحدث في HTML .
الصفحات ذات الصلة
دروس HTML: أنماط HTML
مرجع DOM HTML: ارتباط كائن
إعدادات CSS الافتراضية
ستعرض معظم المتصفحات <link>
العنصر بالقيم الافتراضية التالية:
link {
display: none;
}