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

HTML How to Make a Website CSS: Cascading Style Sheets Take a Mobile-First Approach

Write a CSS declaration that will remove the underlines from all the links on the page.

Write a CSS declaration that will remove the underlines from all the links on the page.

list-style: none;

something like that I think, try copy and pasting it

1 Answer

Erik McClintock
Erik McClintock
45,783 Points

To remove all the underline styles from anchors on the page, you will need to do two things: 1) target the correct element(s), and 2) use the appropriate property and value.

1) The element(s) we want to target are ALL of the anchor elements (i.e. the "links"). To do this, you'll want to use an element selector. The element for anchors ("links") is simply a, so you would write your selector as follows:

a {
}

2) Anchors receive their default underline via the text-decoration property, so that is the property that we will want to declare and then edit:

a {
    text-decoration: none;
}

The above snippet will target all the anchor elements on your site, and then remove the text-decoration (i.e. the "underline") from them. If you are having trouble with this, go back and rewatch some of the videos in the course that you're on and don't move forward until you grasp the concept. This is of the utmost importance to being able to understand and write CSS, as it is the most basic of things you can do!

Happy coding!

Erik