Vetia content
Vetia content lejon futjen
e tekstit të gjeneruar arbitrar në etiketa. Aplikohet
bashkë me pseudo-elementet after
dhe before.
Sintaksa
përzgjedhës::after {
content: 'tekst';
}
përzgjedhës::before {
content: 'tekst';
}
Shembull
Le të fusim tekst shtesë në fillim dhe në fund të tekstit të etiketës li:
<ul>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
</ul>
li::before {
content: '!!!';
}
li::after {
content: '???';
}
:
Shembull
Tekstit të futur mund t'i aplikohen stile të ndryshme. Le ta ngjyrosim, për shembull, këtë tekst me ndonjë ngjyrë:
<ul>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
<li>list item</li>
</ul>
li::before {
color: red;
content: '!!!';
}
li::after {
color: green;
content: '???';
}
:
Shihni gjithashtu
-
funksionin
attr,
që merr vlerën e atributit të etiketës -
vetinë
counter-increment,
që vendos numërimin automatik