Pseudo-elementi :first-line :first:letter :before e :after

Pagina di prova dei pseudo-elementi css

NB: :before e :after NON supportato da Internet Explorer

Articolo completo sui selettori CSS su css.FlepStudio.org

Ritorna alla lista delle pagine di prove dei selettori css su Onsitus.it.

1. :first-line - Esempio per selezionare la prima riga d'un paragrafo

Regola css:

p:first-line{
font-style: italic;
color: red;
}

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

2. :first-letter - Esempio per selezionare il primo carattere d'un paragrafo

Regola css:

p:first-letter{
font-style: italic;
color: red;
font-size: 30px;
}

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

3. :before :after - Esempio di contenuti generati prima e dopo un paragrafo

Regole css:

p:before{
content: "Sono un contenuto generato prima del paragrafo";
font-style: italic;
color: red;
font-size: 30px;
}
p:after{
content: "Sono un contenuto generato dopo il paragrafo";
font-style: italic;
color: green;
font-size: 30px;
}

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.