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 Let's Practice Selectors!

Eduardo Ramirez
Eduardo Ramirez
1,553 Points

Why is the text-decoration not applying to my visited pseudo selector.

Why doesn't my "text-decoration-line: line-through;" appear on my visited pseudo selector even if the other declarations do get applied?

/* Create visited and hover styles for all links inside 'main' */

main a:visited { color: rgb(155,140,178); text-decoration-line: line-through; }

Ezra Siton
Ezra Siton
12,644 Points

Wrong syntax. This is the corrected value

text-decoration: line-through;

https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration

3 Answers

apparently there was an exploit in css that allowed people to use the :visited {text-decoration: ; } syntax to see a user's web history. to close this exploit browsers had to make the :visited{text-decoration: ;} syntax invalid/incompatible, so the two can no longer function in conjunction, all else seems to be fine, such as: background: ; color: ; text-size: ; etc.. but you cannot use the text-decoration in conjunction with the :visited pseudo-class anymore.

this link shows the list of valid syntax that uses the :visited pseudo-class.

https://developer.mozilla.org/en-US/docs/Web/CSS/Privacy_and_the_:visited_selector#limits_to_visited_link_styles

credit to Brian Jensen - FEWD Student Success Specialist for providing the above link https://treehouse-fewd-102.slack.com/team/UNXTK1C9W

Jack Spangenberg
Jack Spangenberg
643 Points

text-decoration is the correct class.

Example:

text-decoration: none;
Eduardo Ramirez
Eduardo Ramirez
1,553 Points

I've modified it and it still doesn't apply the change. I want there to be a line-through each link that has been visited. It does apply the color though.

Espen Gunstensen
Espen Gunstensen
1,574 Points

I have the same issue as yourself. The color works, but not the text-decoration. I did the same suggestions as the suggestions above.