<style>: ì¤íì¼ ì ë³´ ìì
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since 2015ë 7ì.
* Some parts of this feature may have varying levels of support.
HTML <style> ììë 문ìë 문ì ì¼ë¶ì ëí ì¤íì¼ ì 보를 í¬í¨í©ëë¤.
ìëí´ ë³´ê¸°
<style>
p {
color: #26b72b;
}
code {
font-weight: bold;
}
</style>
<p>
This text will be green. Inline styles take precedence over CSS included
externally.
</p>
<p style="color: blue">
The <code>style</code> attribute can override it, though.
</p>
p {
color: #f00;
}
<style> ììë 문ìì <head> ìì ìì¹í´ì¼ í©ëë¤. ê·¸ë¬ë, ì¼ë°ì ì¼ë¡ ì¤íì¼ì ì¸ë¶ ì¤íì¼ ìí¸ì ìì±íê³ , <link> ììë¡ ì°ê²°íë í¸ì´ ì¢ìµëë¤.
문ìê° ë¤ìì <style>ê³¼ <link> ìì를 í¬í¨íë©´ ìë¡ì ììëë¡ DOMì ì¤íì¼ì ì ì©í©ëë¤. ë°ë¼ì ììì¹ ëª»í ì¢
ì 문ì 를 í¼íë ¤ë©´ ì¬ë°ë¥¸ ìì를 ë°ë¼ <style> ë° <link> ìì를 ë°°ì¹í´ì¼ í©ëë¤.
<link> ììì ëì¼íê², <style> ììë 미ëì´ ì¿¼ë¦¬ë¥¼ ê°ì¼ë¡ ê°ì§ë media í¹ì±ì í¬í¨í ì ììµëë¤. ì´ë¥¼ íµí´ ë·°í¬í¸ ëë¹ ë± ë§¤ì²´ 기ë¥ì ë°ë¼ ì íì ì¼ë¡ ì¤íì¼ ìí¸ë¥¼ ì ì©í ì ììµëë¤.
í¹ì±
ì´ ììë ì ì í¹ì±ì í¬í¨í©ëë¤.
type-
ì¤íì¼ ì¸ì´ì MIME ì í. 문ìì ì ì§ì íì§ ììì¼ í©ëë¤. ì í ì¬íì´ë©°, 기본ê°ì
text/cssì ëë¤. ë¹ ë¬¸ìì´ê³¼text/cssì¸ì ê°ì ì¬ì©íì§ ììµëë¤.ì°¸ê³ : íëì ì¸ ì¹ ë¬¸ììì ì´ í¹ì±ì í¬í¨í ì´ì ë ê±°ì ì¡´ì¬íì§ ììµëë¤.
media-
ì¤íì¼ì ì ì©í 매체. ê°ì 미ëì´ ì¿¼ë¦¬ì´ë©°, ëë½í ê²½ì° ê¸°ë³¸ê°ì
allì ëë¤. nonce-
style-src Content-Security-Policyìì ì¸ë¼ì¸ ì¤íì¼ì íì´í¸ë¦¬ì¤í¸ì ì¶ê°í ë ì¬ì©íë ë ¼ì¤(ìì ê°). ìë²ë ë§¤ë² ì ì± ì ì ì¡í ëë§ë¤ ìë¡ì´ ê³ ì ë ¼ì¤ë¥¼ ìì±í´ì¼ í©ëë¤. ë ¼ì¤ ê°ì ìê³ ìë 공격ìë¼ë©´ 리ìì¤ ì ì± ì ì°ííë ê²ì ë§¤ì° ê°ë¨í ì¼ì´ë¯ë¡, ì¬ì ì ì ì¶í ì ìë ê°ì ìì±íë ê²ì´ ì¤ìí©ëë¤. title-
ëì²´ ì¤íì¼ ìí¸ ì¸í¸ë¥¼ ì§ì í©ëë¤.
ì¬ì© ì¤ë¨ë í¹ì±
scoped-
ì§ì í ê²½ì°,
<style>ììì ë¶ëª¨ ë° ë¶ëª¨ì ìììë§ ì¤íì¼ì ì ì©í©ëë¤.ì°¸ê³ :
scopedí¹ì±ì https://github.com/w3c/csswg-drafts/issues/3547ì ë°ë¼ ëì¤ì ë¤ì ì¶ê°ë ìë ììµëë¤. ì§ê¸ ì¬ì©íê³ ì¶ì ê²½ì° í´ë¦¬íì ì¶ê°íì¸ì.
ìì
>ê°ë¨í ì¤íì¼ ìí¸
<!doctype html>
<html>
<head>
<style>
p {
color: red;
}
</style>
</head>
<body>
<p>This is my paragraph.</p>
</body>
</html>
ë¤ìì <style> ìì
ë¤ì ìì ë ë ê°ì <style> ìì를 ì¬ì©í©ëë¤. ê°ì ëª
ìë를 ê°ì§ ê²½ì°, ë¤ìª½ <style>ì´ ì쪽ì ë®ì´ì°ë ê²ì 주목íì¸ì.
<!doctype html>
<html>
<head>
<style>
p {
color: white;
background-color: blue;
padding: 5px;
border: 1px solid black;
}
</style>
<style>
p {
color: blue;
background-color: yellow;
}
</style>
</head>
<body>
<p>This is my paragraph.</p>
</body>
</html>
미ëì´ ì¿¼ë¦¬ í¬í¨
ì´ë² ìì ììë ìì ì½ëì ë ë²ì§¸ <style> ììì media í¹ì±ì ì¶ê°íê³ , ë·°í¬í¸ì ëë¹ê° 500px 미ë§ì¼ ëìë§ ì¤íì¼ì ì ì©íëë¡ ì§ì í©ëë¤.
<!doctype html>
<html>
<head>
<style>
p {
color: white;
background-color: blue;
padding: 5px;
border: 1px solid black;
}
</style>
<style media="all and (max-width: 500px)">
p {
color: blue;
background-color: yellow;
}
</style>
</head>
<body>
<p>This is my paragraph.</p>
</body>
</html>
기ì ìì½
| ì½í ì¸ ì¹´í ê³ ë¦¬ |
ë©íë°ì´í° ì½í
ì¸ . scoped í¹ì±ì´ ì¡´ì¬íë©´
íë¡ì° ì½í
ì¸ .
|
|---|---|
| ê°ë¥í ì½í ì¸ | type í¹ì±ì ë§ë í
ì¤í¸, ì¦ text/css. |
| íê·¸ ìëµ | ë¶ê°ë¥, ììê³¼ ëì í그를 ì¶ê°íë ê²ì íìì ëë¤. |
| ê°ë¥í ë¶ëª¨ ìì | ë©íë°ì´í° ì½í ì¸ ë¥¼ íì©íë 모ë ìì |
| ê°ë¥í ARIA ìí | ìì |
| DOM ì¸í°íì´ì¤ | HTMLStyleElement |
ëª ì¸
| Specification |
|---|
| HTML> # the-style-element> |
ë¸ë¼ì°ì í¸íì±
ê°ì´ 보기
- ì¸ë¶ ì¤íì¼ ìí¸ë¥¼ ì¬ì©í기 ìí
<link>ìì.