Home > Mobile >  How to select text between ::before and ::after
How to select text between ::before and ::after

Time:12-09

How do I make a CSS selector to target the text in this example and not the whole h1 element? Just the text and not the before and after elements.

The before and after elements has a border-top, trying to add some animation to the text and not effect the border-top part.

h1::before {}

h1::after {}
<h1>my heading</h1>

CodePudding user response:

I think it looks like this in CSS:

*, *::before, *::after {

}

CodePudding user response:

Try this:

h1 :not(h1::before, h1::after){
//CSS here
}
  • Related