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 How to Make a Website CSS: Cascading Style Sheets Style the Basic Elements

Eric Bezanson
Eric Bezanson
2,907 Points

cant solve: "Remove the underlines from all the links on the page."

I cant solve this question. I know the question is to remove the underlines on the anchor elements, and the code i tried was

div h2 {

text-decoration: none; }

and it is telling me to check the value of the properyu text-decoration? the value is supposed to be none?

PS: it dosent show the html so i have tried multiple different div's like div h, div a, div etc all keep giving me the same error message....

css/main.css
{text-decoration: none;}

3 Answers

Erik McClintock
Erik McClintock
45,783 Points

Eric,

The problem here is that you're not targeting the correct elements. Recall that an anchor element refers to the links on your page, the tag for which is "a". So, to target the anchors on your page, you would write the following selector in your CSS:

a {
    /*your property declarations go here*/
}

Your property declaration and value are correct (i.e. "text-decoration: none;"); the challenge is throwing that error mistakenly, as it detects that something is wrong, and expected that if something were wrong, it would likely be the property declaration over the selector.

Erik

Eric Bezanson
Eric Bezanson
2,907 Points

hey thanks for the reply. looks like my code did not replecate properly in my question as I had tried targeting div a, div h, and more specifically div h2 all of which were still giving me the error that the text-decoration value is incorrect. to remove the underline from all links should it not look like:

div a { text-decoration: none; }

(except spaced and tabbed for readability)

Erik McClintock
Erik McClintock
45,783 Points

Eric,

By selecting "div a", you're only targeting anchors on the page that are nested within divs. To target every single anchor on the page, regardless of what it might be nested in or not, you need to use the selector that I wrote above, and have written again here:

a {
/*your property declarations go here*/
}

Remember that there is a wide variety of selectors in CSS, and each one does something very specific. Try this fun game called CSS Diner; it will help you learn your different selectors.

Erik

Daniel Sattler
Daniel Sattler
4,867 Points

Try this:

a:link { text-decoration: none; }

a:visited { text-decoration: none; }

a:hover { text-decoration: none; }

a:active { text-decoration: none; }

Milo Winningham
seal-mask
.a{fill-rule:evenodd;}techdegree
Milo Winningham
Web Development Techdegree Student 3,317 Points

You're on the right track with text-decoration: none but you need to apply that to all links on the page. Using div h2 for the selector would apply only to h2s nested inside of divs, which wouldn't have underlines to begin with, and div a would apply only to links nested within a div rather than everywhere on the page.