I would like to use HTML entities in CSS, but it shows me the •
instead.
.down:before{ content:"• "; color:#f00; }
Also, why does the above code not work in IE? it does not show the before part at all.
Unfortunately, this is not possible. Per the spec: Generated content does not alter the document tree.
To add real spaces to your text, you can use the character entity. Tip: The non-breaking hyphen (‑) is used to define a hyphen character (‑) that does not break into a new line.
The content property in CSS is used to generate the content dynamically (during run time) ie., it replaces the element with generated content value. It is used to generate content ::before & ::after pseudo-element.
::before (:before) In CSS, ::before creates a pseudo-element that is the first child of the selected element. It is often used to add cosmetic content to an element with the content property. It is inline by default.
put hex value of your bullet specail character like this
div:before{ content:"\2022"; color:#f00; }
check this fiddle http://jsfiddle.net/sandeep/HPrkU/1/
NOTE: after & before work in IE8
I'm guessing you want the actual •
character displayed, if so simply use the •
character instead of •
.
Example: http://jsfiddle.net/rmjt8/
Edit: I found another thread: How can I include a HTML-encoded "content:" character in CSS?
Perhaps this will validate:
.down:before{ content:"\2022 "; color:#f00; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With