-4

I am aware that content can be displayed with css using content

.email-address:before {
   content: "Email address: ";
}

But what if I wanted to do something like this:

.email-address:before {
   content: "<strong class='my text'>Email address:</strong>";
}

is this possible?

Luke101
  • 56,845
  • 75
  • 204
  • 330
  • 6
    Why don't you try it and see what happens? it'd probably take LESS time to whip up a test case and run it through your browser than it did for you to type this up and wait for an answer. – Marc B Aug 13 '14 at 20:41
  • 1
    nop, but you can do font-weight:bold; and any CSS like any regular inline box. border:solid; float; display:list-item, ... whatever you need – G-Cyrillus Aug 13 '14 at 20:41
  • @ctwheels Why would you use JS for it? – bjb568 Aug 13 '14 at 20:50
  • @MarcB i have tried it before posting this question. I just posted this to make it clear what i am trying to do. – Luke101 Aug 14 '14 at 17:02

2 Answers2

3

No, but.

What you can do is :

.email-address:before {
   content: "Email address: ";
   font-weight:bold;
}

and or :

.email-address:before, .my-text {
    /* Rules for my-text */ 
}

<edit>

If your idea was to retrieve some pieces of text you can use data-attributes.

<p class="email-address" data-name="myName" data-com="mydomain.com"></p>

and

.email-address:before {
   content: "Email address: "attr(data-name)'@'attr(data-com);
   font-weight:bold;
}

demo

G-Cyrillus
  • 85,910
  • 13
  • 85
  • 110
0

No. No DOM element will be altered. The content will be only referenced as text and not HTML.

Ajk_P
  • 1,864
  • 16
  • 23