content
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.
CSS content ìì±ì ìì±í ê°ì¼ë¡ ìì를 ëì²´í©ëë¤. content ìì±ì¼ë¡ ì¶ê°í ììë "ìµëª
ëì²´ ìì"ì
ëë¤.
/* ë¤ë¥¸ ê°ê³¼ ì¡°í©í ì ìë í¤ìë */
content: normal;
content: none;
/* <image> ê° */
content: url("http://www.example.com/test.png");
content: linear-gradient(#e66465, #9198e5);
/* ìì±í ê°ì ëì²´ í
ì¤í¸, Level 3 ëª
ì¸ìì ì¶ê° */
content: url("http://www.example.com/test.png") / "This is the alt text";
/* ìì ê°ì 모ë ::beforeì ::afterìë§ ì ì© ê°ë¥ */
/* <string> ê° */
content: "prefix";
/* <counter> ê° */
content: counter(chapter_counter);
content: counters(section_counter, ".");
/* HTML ìì±ê°ì¼ë¡ ì°ê²°íë attr() */
content: attr(value string);
/* ì¸ì´ì ìì ìì¹ ê¸°ë° í¤ìë */
content: open-quote;
content: close-quote;
content: no-open-quote;
content: no-close-quote;
/* normalê³¼ noneì ì ì¸íë©´ ì¬ë¬ í¤ìë를 í¨ê» ì¬ì©í ì ìì */
content: open-quote chapter_counter;
/* ì ì ê° */
content: inherit;
content: initial;
content: unset;
| ì´ê¸°ê° | normal |
|---|---|
| ì ì©ëì | All elements, tree-abiding pseudo-elements, and page margin boxes |
| ìì | no |
| ê³ì° ê° | On elements, always computes to normal. On ::before and ::after, if normal is specified, computes to none. Otherwise, for URI values, the absolute URI; for attr() values, the resulting string; for other keywords, as specified. |
| Animation type | discrete |
구문
>ê°
none-
ìì¬ ìì를 ìì±íì§ ìì.
normal-
::beforeì::afterìì¬ ììì¸ ê²½ì°none. <string>-
ììì "ëì²´ í ì¤í¸". 모ë ì«ìì 문ìê° ê°ë¥í©ëë¤. ë¨, ë¼í´ê³ 문ìê° ìë ê²½ì° ì ëì½ë ì´ì¤ì¼ì´í ìíì¤ë¥¼ ì¬ì©í´ ì¸ì½ë©í´ì¼ í©ëë¤. ì를 ë¤ì´,
\000A9ë ì ìê¶ ê¸°í¸ì ëë¤. <image>-
<url>ì´ë<gradient>ìë£íì ì¬ì©í<image>, ëëelement()í¨ì를 ì¬ì©í´ ê°ë¦¬í¨, ë³´ì¬ì¤ ì¹íì´ì§ì ì¼ë¶. <counter>()-
ë³´íµ ì«ìì¸ CSS ì¹´ì´í° ê°.
counter()ëcounters()í¨ì를 ì¬ì©í´ ì§ì í ì ììµëë¤.counter()í¨ìëcounter(<var>name</var>)ê³¼counter(<var>name</var>, <var>style</var>)ì ë íí를 ê°ì§ê³ ììµëë¤. ìì±íë ê°ì 주ì´ì§ ìì¬ ììì íì¬ ë²ììì, í´ë¹íë ì´ë¦ì ê°ì§ ê°ì¥ ì쪽 ì¹´ì´í°ì ê°ì ëë¤. ì§ì í ì¤íì¼(기본decimal)ì ë§ì¶° ììì ì ì©í©ëë¤.counters()í¨ì ììcounters(<var>name</var>, <var>string</var>)'ê³¼ 'counters(<var>name</var>, <var>string</var>, <var>style</var>)ì ë íí를 ê°ì§ëë¤. ìì±íë ê°ì 주ì´ì§ ìì¬ ììì íì¬ ë²ììì, í´ë¹íë ì´ë¦ì ê°ì§ ì¹´ì´í° ê°ì 목ë¡ì¼ë¡ ë°ê¹¥ìª½ë¶í° ììíë©° 주ì´ì§ 문ìì´ì ì¬ì©í´ 구ë¶í©ëë¤. ì§ì í ì¤íì¼(기본decimal)ì ë§ì¶° ììì ì ì©í©ëë¤.. attr(x)-
문ìì´ë¡ ë³íí, ìì ìì±
xì ê°.xìì±ì´ ì¡´ì¬íì§ ìì¼ë©´ ë¹ ë¬¸ìì´ì ë°íí©ëë¤. ìì±ëª ì ëì문ì êµ¬ë¶ ì¬ë¶ë 문ì ì¸ì´ì ë°ë¦ ëë¤. open-quote|close-quote-
quotesìì±ìì ê°ì ¸ì¨ ì ì í 문ìì´ì ì¬ì©í´ ëì²´. no-open-quote|no-close-quote-
ì½í ì¸ ë ì¶ê°íì§ ìê³ , ëì ë°ì´íì ì¤ì²© ë¨ê³ë¥¼ ì¦ê°.
íì 구문
content =
normal |
none |
[ <content-replacement> | <content-list> ] [ / [ <string> | <counter> | <attr()> ]+ ]? |
<element()>
<content-replacement> =
<image>
<content-list> =
[ <string> | <image> | <attr()> | contents | <quote> | <leader()> | <target> | <string()> | <content()> | <counter> ]+
<counter> =
<counter()> |
<counters()>
<attr()> =
attr( <attr-name> <attr-type>? , <declaration-value>? )
<element()> =
element( <id-selector> )
<image> =
<url> |
<image()> |
<image-set()> |
<cross-fade()> |
<element()> |
<gradient>
<quote> =
open-quote |
close-quote |
no-open-quote |
no-close-quote
<leader()> =
leader( <leader-type> )
<target> =
<target-counter()> |
<target-counters()> |
<target-text()>
<string()> =
string( <custom-ident> , [ first | start | last | first-except ]? )
<content()> =
content( [ text | before | after | first-letter | marker ]? )
<counter()> =
counter( <counter-name> , <counter-style>? )
<counters()> =
counters( <counter-name> , <string> , <counter-style>? )
<attr-name> =
[ <ident-token>? '|' ]? <ident-token>
<attr-type> =
type( <syntax> ) |
raw-string |
number |
<attr-unit>
<id-selector> =
<hash-token>
<image()> =
image( <image-tags>? [ <image-src>? , <color>? ]! )
<image-set()> =
image-set( <image-set-option># )
<cross-fade()> =
cross-fade( <cf-image># )
<leader-type> =
dotted |
solid |
space |
<string>
<target-counter()> =
target-counter( [ <string> | <url> ] , <custom-ident> , <counter-style>? )
<target-counters()> =
target-counters( [ <string> | <url> ] , <custom-ident> , <string> , <counter-style>? )
<target-text()> =
target-text( [ <string> | <url> ] , [ content | before | after | first-letter ]? )
<counter-name> =
<custom-ident>
<counter-style> =
<counter-style-name> |
<symbols()>
<syntax> =
'*' |
<syntax-component> [ <syntax-combinator> <syntax-component> ]* |
<syntax-string>
<attr-unit> =
<custom-ident>
<image-tags> =
ltr |
rtl
<image-src> =
<url> |
<string>
<image-set-option> =
[ <image> | <string> ] [ <resolution> || type( <string> ) ]?
<cf-image> =
[ <image> | <color> ] &&
<percentage [0,100]>?
<counter-style-name> =
<custom-ident>
<symbols()> =
symbols( <symbols-type>? [ <string> | <image> ]+ )
<syntax-component> =
<syntax-single-component> <syntax-multiplier>? |
'<' transform-list '>'
<syntax-combinator> =
'|'
<syntax-string> =
<string>
<symbols-type> =
cyclic |
numeric |
alphabetic |
symbolic |
fixed
<syntax-single-component> =
'<' <syntax-type-name> '>' |
<ident>
<syntax-multiplier> =
'#' |
'+'
<syntax-type-name> =
angle |
color |
custom-ident |
image |
integer |
length |
length-percentage |
number |
percentage |
resolution |
string |
time |
url |
transform-function
ìì
>í¤ë©ê³¼ ë°ì´í
ë¤ì ìì ë ì¸ì©êµ¬ 주ë³ì ë°ì´í를 ì¶ê°íê³ , í¤ë© ìì ë¨ì´ "Chapter"를 ì¶ê°í©ëë¤.
HTML
<h1>5</h1>
<p>
According to Sir Tim Berners-Lee,
<q cite="http://www.w3.org/People/Berners-Lee/FAQ.html#Internet"
>I was lucky enough to invent the Web at the time when the Internet already
existed - and had for a decade and a half.</q
>
We must understand that there is nothing fundamentally wrong with building on
the contributions of others.
</p>
<h1>6</h1>
<p>
According to the Mozilla Manifesto,
<q cite="http://www.mozilla.org/en-US/about/manifesto/"
>Individuals must have the ability to shape the Internet and their own
experiences on the Internet.</q
>
Therefore, we can infer that contributing to the open web can protect our own
individual experiences on it.
</p>
CSS
q {
color: blue;
}
q::before {
content: open-quote;
}
q::after {
content: close-quote;
}
h1::before {
content: "Chapter "; /* The trailing space creates separation
between the added content and the
rest of the content */
}
ê²°ê³¼
ì´ë¯¸ì§ì í ì¤í¸
ë¤ì ìì ë ë§í¬ ìì ì´ë¯¸ì§ë¥¼ ì¶ê°í©ëë¤. ì´ë¯¸ì§ë¥¼ ê°ì ¸ì¤ì§ 못í ê²½ì° í ì¤í¸ë¥¼ ëì ì¶ê°í©ëë¤.
HTML
<a href="http://www.mozilla.org/en-US/">Mozilla Home Page</a>
CSS
a::before {
content: url("https://mozorg.cdn.mozilla.net/media/img/favicon.ico")
" MOZILLA: ";
font:
x-small Arial,
sans-serif;
color: gray;
}
ê²°ê³¼
í´ëì¤ ì¬ì©
ë¤ì ìì ë 목ë¡ì í¹ë³í í목 ë¤ì ì¶ê° í ì¤í¸ë¥¼ ì½ì í©ëë¤.
HTML
<h2>Paperback Best Sellers</h2>
<ol>
<li>Political Thriller</li>
<li class="new-entry">Halloween Stories</li>
<li>My Biography</li>
<li class="new-entry">Vampire Romance</li>
</ol>
CSS
.new-entry::after {
content: " New!"; /* The leading space creates separation
between the added content and the
rest of the content */
color: red;
}
ê²°ê³¼
ì´ë¯¸ì§ì ìì ìì±
ë¤ì ìì ë ë§í¬ ìì ì´ë¯¸ì§ë¥¼ ì¶ê°íê³ , ë¤ì id ìì±ì ê°ì ë¶ì
ëë¤.
HTML
<ul>
<li><a id="moz" href="http://www.mozilla.org/"> Mozilla Home Page</a></li>
<li>
<a id="mdn" href="https://developer.mozilla.org/">
Mozilla Developer Network</a
>
</li>
</ul>
CSS
a {
text-decoration: none;
border-bottom: 3px dotted navy;
}
a::after {
content: " (" attr(id) ")";
}
#moz::before {
content: url("https://mozorg.cdn.mozilla.net/media/img/favicon.ico");
}
#mdn::before {
content: url("mdn-favicon16.png");
}
li {
margin: 1em;
}
ê²°ê³¼
ìì ëì²´
ë¤ì ìì ë ììì ì½í
ì¸ ë¥¼ ì´ë¯¸ì§ë¡ ëì²´í©ëë¤. <url> ëë <image> ì¬ì©íë©´ ì½í
ì¸ ë¥¼ ëì²´í©ëë¤. ìì를 ëì²´íì¼ë¯ë¡ ::beforeë ::afterë ìì±íì§ ììµëë¤.
HTML
<div id="replaced">Mozilla</div>
CSS
#replaced {
content: url("mdn.svg");
}
#replaced::after {
/* will not show if element replacement is supported */
content: " (" attr(id) ")";
}
ê²°ê³¼
ì ê·¼ì± ê³ ë ¤ì¬í
CSSë¡ ìì±í ì½í ì¸ ë DOMì´ í¬í¨íì§ ìê³ , ì ê·¼ì± í¸ë¦¬ìë ë¤ì´ê°ì§ ììµëë¤. ë°ë¼ì í¹ì ì ê·¼ì± ê¸°ì /ë¸ë¼ì°ì ì¡°í©ì´ ë´ì©ì íííì§ ìì ì ììµëë¤. ì½í ì¸ ê° í¬í¨í ì ë³´ê° íì´ì§ì 목ì ì ì´í´íë ê²ì ì¤ìíë¤ë©´ 주 문ìë¡ í¬í¨íë ê²ì´ ì¢ìµëë¤.
ëª ì¸
| Specification |
|---|
| CSS Generated Content Module Level 3 > # propdef-content > |