0

is there any CSS way to add div, p, span elements inside css content attribute? I mean code like this

.textblockquote:before{
content: "<span class='green'>“</span>";

}

D.Shinekhuu
  • 307
  • 3
  • 12

5 Answers5

2

No, CSS is all about styling, not adding code. You might be able to workaround this, but it's very bad practice.

It will probably be easier to achieve the requested effect or design in another way.

Itay Gal
  • 10,706
  • 6
  • 36
  • 75
2

You can achive this with hexadecimal characters, but you shouldn't :)

See here: Adding HTML entities using CSS content

Community
  • 1
  • 1
wintercounter
  • 7,500
  • 6
  • 32
  • 46
2

you won't be able to insert other things than text-element with css

BUT, what you want to do can be achieved this way :

.textblockquote:before{
    color:green; /* <-- apply the styling you want */
    content: "\0022"; /* <-- escaped unicode for 'quote' */
}

In the meantime, your question has already been answered (30 months ago): Using :before and :after CSS selector to insert Html

Look : enter image description here

Community
  • 1
  • 1
Milche Patern
  • 19,632
  • 6
  • 35
  • 52
1

Its possible but its designed for text not html. http://www.quirksmode.org/css/content.html,

Here is an example how you can achive this in Firefox. ( 2nd answer ) Insert HTML from CSS

Community
  • 1
  • 1
scx
  • 2,749
  • 2
  • 25
  • 39
-1

You can add content as text for example, and customize it for you needs. In your case, you can add quotes in content of :before and :after elements, and absolute position them where you want.

n1kkou
  • 3,096
  • 2
  • 21
  • 32