0

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
  • 34,719
  • 24
  • 185
  • 251
Gaurav
  • 765
  • 1
  • 10
  • 32

3 Answers3

3

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
  • 367,681
  • 72
  • 526
  • 573
2

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

Madara's Ghost
  • 165,920
  • 50
  • 255
  • 304
0

Hacss may provide the experience you're looking for.

Demo

Nick Saunders
  • 413
  • 1
  • 3
  • 9