DEV Community

Discussion on: Do you use CSS ::before and ::after pseudo elements?

Collapse
 
jnschrag profile image
Jacque Schrag

I use pseudo elements all the time! Like others have said, if I’m creating something that is only for design & not actual content, I try to use pseudo elements.

One of my favorite ways to use them is when I have an element inside of content that has a full width background, but I need the content inside of that element to be the same width as the rest of the content. Rather than using a bunch of wrapper classes, you can use pseudo elements to render the different background color that extends the full width of the screen.

Collapse
 
brob profile image
Bryan Robinson

Ooooooh, interesting idea! I'd never thought about that.