Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS CSS Selectors Advanced Selectors Pseudo-Elements - ::first-line and ::first-letter

What is a virtual element?


Not looking for a definition of a psuedo-element since I get. I can't find any reference as to what is meant by a 'virtual element'.

3 Answers

Justin Goldby
Justin Goldby
Full Stack JavaScript Techdegree Student 12,754 Points

To add to Yann's answer, look at "first-line" it is like an implied element, because in the HTML markup there is no specific element of first-line listed, it is just something that is contained within the language. We don't actually have to create these elements within the HTML.

There is no such thing as virtual elements. Do you mean pseudo elements?

After going over the video transcript I found this:

"Pseudo-elements are exactly what their name implies. They are phony elements that are not part of the DOM the way real HTML elements are and they can help keep our HTML cleaner...

... they target virtual elements that are not defined in the markup."

If you get what is a pseudo element, it's targeting a virtual element because it don't explicitely exist. Let's say div::after is not in the html but it specifies that div added with a ::after in the css. It will do somehing to that div under the ::after circumstance.