Grow your CSS skills. Land your dream job.

Can you have HTML in a pseudo element?

  • # June 20, 2013 at 4:58 am

    I’m quite new to pseduo elements and am struggling to get it to render HTML. Can you not render HTML in a pseudo element as the browser just seems to print a string of text out to the page rather than rendering the element?

    I’ve made a codepen here:

    http://codepen.io/johnasp/pen/gBrdv

    # June 20, 2013 at 5:32 am

    Simple answer….**NO**.

    HTML is not allowed.

    What are you trying to do?

    # June 20, 2013 at 5:43 am

    Is it something like this: http://codepen.io/codegraphics/pen/zCnfH

    # June 26, 2013 at 4:28 pm

    Yes it is mate, that exactly what I was after! What’s going on there?

    # June 26, 2013 at 5:09 pm

    > Simple answer….NO.

    There is no complicated answer. CSS cannot generate HTML.

    # June 26, 2013 at 5:10 pm

    > Yes it is mate, that exactly what I was after! What’s going on there?

    Unicode. Alternatively you could use Icon fonts.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".