1

Is it possible to add pseudo element declaration inline. For eg. can I do the following inline ?

.XYZ:after {
content: '';
width: 100%;
display: inline-block;}

<div class="XYZ"></div> /*Pseudo element should be declarer inline*/
Cœur
  • 37,241
  • 25
  • 195
  • 267
Gaurav
  • 794
  • 2
  • 11
  • 32

3 Answers3

4

No, it is not possible to apply pseudo selectors via inline CSS, that's only possible from within <style></style> blocks or external stylesheet file.

Imagine constructing an email template with inline pseudo selector that uses content property, bad guys could have done the harm I suppose. So it is not possible.

Sarfraz
  • 377,238
  • 77
  • 533
  • 578
2

No. pseudo element stylings may only be declared in an external stylesheet or inside <style></style> tags.

Madara's Ghost
  • 172,118
  • 50
  • 264
  • 308
0

Hacss may provide the experience you're looking for.

Demo

Nick Saunders
  • 453
  • 1
  • 4
  • 9