Home html How to use HTML tags in CSS (content)

How to use HTML tags in CSS (content)

Author

Date

Category

Hello, I would like to know how you can use HTML tags in the CSS (content) field.
Here is the code

. hello {
  position: absolute;
  width: 95%;
  top: 100px;
  left: 0;
  font-size: 11px;
  line-height: 40px;
  text-align: left;
  color: # 000000;
}
.timer: after {
 content: "& lt; span id =" Hello "class =" Hello "& gt; Hello & lt; / span & gt;";
 content: "Blah blah blah:";
}

Answer 1, authority 100%

HTML is not allowed in content, only text. Actually, the css itself is bound to html only conditionally, css can set the styles of anything. In general, if something is shoved into after, then, most likely, you need to change the template, not html, after is to put a red asterisk on all label.required , for example.


Answer 2, authority 33%

Well, at least you need to use different types of quotes, and yes, any text in content will be presented as text.

content: "& lt; span id = 'Hello' class = 'Hello' & gt; Hello & lt; / span & gt;";

Answer 3, authority 33%

Yes, write to your health, but do not shove HTML tags there, they do not belong there. The principle is – flies separately, and cutlets separately. Example, I need on ul , add my list-items and color and align it, no problem, I write that I have l ist-items no, but li: after I put in content: "✔"; and besides, font size and color and whatever phantasmagorias you can imagine. So I have a nice checkbox in content, the only rule is to push only Unicode into styles


Answer 4

You can only insert a picture with an image, which will contain formatted text, using the construction content: url (...)
But tags in content will only be interpreted as text.

Previous articleStrlen () on si in one line
Next articlePHP DATE_DIFF

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions