Pseudo contenido con CSS

11/Dic/2013 233

La propiedad CSS content: «»; viene siendo utilizada para entregar más estilos donde no necesitas extra marcado con HTML. Su soporte es amplio (IE8+ y demases browsers modernos). Su uso está atado a los pseudo-elementos :after y :before y permite generar contenido (de tipo texto) en dicho pseudo-elemento. Un ejemplo básico:

div {
color: blue;
div:after {
content: "Link: "
color: gray;

Resulta muy útil ya que disponemos de nuevos elementos (vale aclarar que no pertenecen al DOM) los que podemos dar estilos anexos al elemento mismo que estamos manipulando con CSS. Pero este no es el caso de este artículo… (se me ocurre hacer un videocast sobre eso).

Dentro de lo que permite agragarse a través de content está attr(), vale decir, cualquier atributo del elemento que estás manipulando con CSS. Usualmente estás acostumbrado a hacerlo con JavaScript pero en este caso sólo con estilos podemos crear pseudo-elementos y darle contenido nuevo y/o existente. Resulta muy útil si queremos, por ejemplo, hacer un tooltip sólo con CSS rescatando el texto dentro de title:

<a title="Título de este mágico tooltip sólo con CSS3" href="#">tooltip sólo con CSS3</a>
a[title]:hover:after { /* Este es el cuadrado del tooltip que contiene el texto */
content: attr(title);
color: #333;
position: absolute;
left: 50%;
top: -150%;
white-space: nowrap;
z-index: 10;
border-radius: 6px;
background-color: rgba(0,0,0,.7);
color: white;
font-size: .7em;
padding: .1em .5em;
text-shadow: black 1px 1px 0;
a[title]:hover:before { /* Este es el triangulo del tooltip */
position: absolute;
top: -4px;
left: 60%;
content: "";
width: 0;
height: 0;
border-style: solid;
border-width: 7px 7px 0 7px;
border-color: rgba(0,0,0,.7) transparent transparent transparent;

Ya en un muy antiguo artículo proponía su uso en hojas de estilos para impresión media="print" donde para mejor accesibilidad a todos los links se entregara como información impresa la URL al que corresponde ese link luego del texto del enlace mismo.

@media print {
a:after {
content: " ( " attr(href) " ) ";
font-size: small;



  1. early ovulation on clomid [#]

    of course like your website but you need to take a look at the spelling on quite
    a few of your posts. Many of them are rife
    with spelling issues and I in finding it very bothersome to tell the truth nevertheless I’ll surely come back again.

  2. hydroxychloroquine stock ticker [#]

    If you are going for finest contents like
    I do, simply go to see this web site everyday since it provides quality contents, thanks

  3. what is hydroxychloroquine prescribed for [#]

    chloroquine plaquenil hydochloroquine

  4. Umpcnf [#]

    where can i buy clomid – buy clomid 100mg order clomid

  5. Svrgsr [#]

    cheap clomid online – generic clomiphene

  6. hydroxychloroquine for malarial adults [#]

    I really like reading through a post that will make people think.

    Also, many thanks for allowing for me to comment!

  7. tetracycline for acne treatment [#]

    Can I just say what a relief to uncover somebody who actually knows what they
    are discussing on the web. You definitely know how to bring
    a problem to light and make it important. More and more people ought to look at this and
    understand this side of your story. I was surprised you are
    not more popular since you definitely have the gift.

  8. Gbpxzu [#]

    75 mg viagra – 200 mg generic viagra sildenafil over the counter

  9. priligy in australia [#]

    Yes! Finally someone writes about antibiotics.

  10. Ybtlwo [#]

    viagra for sale uk – how to get viagra over the counter can i buy viagra over the counter in south africa

  11. Gazcheedarap [#]

    buy amoxicillin online for humans

  12. keto trim reviews [#]

    keto diet pill

  13. Hwysla [#]

    stromectol nz – buy stromectol canada buy liquid ivermectin

  14. Kyynwp [#]

    ivermectin brand – ivermectin uk coronavirus stromectol covid

  15. gay furry dating website [#]

    collar me gay dating site

  16. gay dating st louis [#]

    gay facebook dating

  17. Gazcheedarap [#]

    reducing fluoxetine

  18. Jcvnsg [#]

    legitimate online slots for money – winslotgms slots online

  19. dating gay white guys [#]

    gay mature men dating sites

  20. how to order generic viagra online [#]

    Great article, exactly what I wanted to find.

  21. free gay trucker dating sites [#]

    teenage gay dating

  22. hydroxychloroquine use by country [#]

    Very nice post. I just stumbled upon your weblog and
    wished to say that I have truly enjoyed surfing around your blog posts.
    In any case I’ll be subscribing to your feed and I hope you write again very

  23. Vfxhyz [#]

    blue pill for ed – non prescription ed pills buy ed pills

  24. Tvkbis [#]

    ed meds online – what is the most effective pill for ed best erectile dysfunction pills

  25. KevinWet [#]

    hivpos & gay dating daiting
    gay christian men dating
    free gamer dating gay

  26. Sukioz [#]

    4mg prednisone daily – 60 mg prednisone daily prednisone 60 mg tablets

  27. hydroxychloroquine human dose [#]

    Great beat ! I would like to apprentice even as
    you amend your web site, how can i subscribe for a blog web site?
    The account aided me a acceptable deal. I have been a little bit familiar of this your broadcast provided brilliant transparent idea

  28. erythromycin buy online [#]

    Fine way of describing, and good post to obtain facts regarding my presentation topic, which i
    am going to present in institution of higher education.

  29. Mqgxgc [#]

    discount generic viagra online – viagra 50mg viagra 250 mg

  30. Gajcheedarap [#]

    was ist dapoxetine

  31. hydroxychloroquine coronavirus trial results [#]

    Hello there! I could have sworn I’ve been to this site before but after browsing through some
    of the post I realized it’s new to me. Nonetheless, I’m
    definitely glad I found it and I’ll be bookmarking and checking back

  32. hydroxychloroquine coronavirus trial results [#]

    Hello there! I could have sworn I’ve been to this site
    before but after browsing through some of the post I realized it’s new to me.
    Nonetheless, I’m definitely glad I found it and I’ll be
    bookmarking and checking back often!

  33. ivermectin review [#]

    stromectol teva 6 mg

    intelligence hypotension hair

  34. tadalafil 40 mg daily [#]

    Highly energetic post, I liked that a lot. Will there be a part 2?

  35. can prednisone cause heartburn [#]

    For newest information you have to pay a visit internet and on internet I found this
    web page as a best website for most recent updates.

  36. priligy at walgreens [#]

    is priligy safe for people

    testimony atherosclerotic plaque outside

  37. PatrickFax [#]

    buy cialis usa

  38. tamoxifen in men [#]

    You actually make it seem really easy together with
    your presentation however I to find this topic to be really one thing that
    I believe I’d never understand. It sort of feels too
    complicated and extremely broad for me. I’m taking
    a look ahead for your next put up, I will try to get the dangle of it!

  39. generic aurogra at walmart [#]

    Do you mind if I quote a few of your posts as long as I provide credit and sources back to
    your weblog? My blog site is in the very same
    area of interest as yours and my users would definitely benefit from some of the information you provide
    here. Please let me know if this ok with you. Many thanks!

  40. sildenafil 100mg tablets for sale [#]

    Hi friends, its wonderful piece of writing on the topic
    of cultureand completely explained, keep it up all the time.

  41. web hosting a [#]

    Wonderful blog! I found it while searching on Yahoo News.
    Do you have any tips on how to get listed in Yahoo News? I’ve been trying for
    a while but I never seem to get there! Appreciate it

  42. [#]

    Wonderful post! We are linking to this great post on our site.
    Keep up the good writing.

  43. Michaelpycle [#]

    gay dating through facebook
    gay dating free denver
    zcout gay dating

  44. gay dating page [#]

    online dating website gay

  45. ivermectin 12 mg tablets for sale [#]

    costo della pillola di ivermectina Pseudo contenido con CSS | CSSLab | Laboratorio de ideas web ivermectin tablets dosage

  46. gay dating site review [#]

    about me for a gay dating site

  47. gay online dating services [#]

    gay dating sim with sex scenes

  48. gay men dating ride [#] belted_boy gay dating