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

getting rid of the underlines from links

I can't seem to get rid of the underlines from the links of my page.

      <header class="main-header">
        <h3 class="logo">website.com</h3>
          <ul class="main-nav">
            <li><a href="index.html">Home</a></li>
            <li><a href="portfolio.html">Portfolio</a></li>
            <li><a href="contact.html">Contact</a></li>
          </ul>
      </header>
*{
    box-sizing: border-box;
    text-decoration: none;
}



body{
    text-align: center;
}

li{
    list-style: none;
}

a{
    text-decoration: none;
}


.main-header, .main-nav{
    font-size: 1.2em;
    margin: 0 auto;
    padding-top: 0;
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    align-items: flex-start;
}

.main-nav ul li{
    flex-direction: row;
}

.logo{
    margin: 0 auto;
}
Tushar Singh
Tushar Singh
Courses Plus Student 8,692 Points

I cant see any underlined element, I literally just copied your code in my workspace.

a{ text-decoration: none; }

This should do the trick.

2 Answers

Sorry guys I just realized I had an additional stylesheet that was overwriting everything :/ lol

anil rahman
anil rahman
7,786 Points

Try using a psuedo-element:

a:link { text-decoration: none; }