Help, how I do style this link?

by Amazin
3 replies
  • WEB DESIGN
  • |
<header>
<link rel="stylesheet" type="text/css" href="mydesign.css">


<H1>This is my world</H1>

<nav>
<a href="about.html">about</a>

</nav>
</header>
the bit in red, basically I created a link to another page called "about". It is part of the navigation links in my header. As you can see the part in blue that I already created a link to an external CSS file. here is the file (mydesign):

H1 {border-style: solid;
text-align: center;
border-width: 5px;
color: #00ff00;}

body {background-color: #33CCFF;
background-image: url(burger.JPG);
background-size: 1200px 650px;
background-repeat: no-repeat;
background-position: center;
background-attachment: fixed;
}

p {text-align: center;color: #00ff00;}

#about {text-align: center;
color: red;

}
As you can see the part in green that I tried to use the CSS selector to select "about" but no luck
#link #style
  • Profile picture of the author David V
    Your misunderstanding the usage of an "ID" (#about) which you don't actually have.

    Create a class to add to the link your trying to style. You could even add a class to all href links within the <nav>.

    For simplicity, here's how to add a class to that one link as you requested.

    Code:
    <nav>
    <a href="about.html" class="aboutlink">about</a>
    </nav>
    Then in the css file, style that class, but remember it's an href.

    Code:
    a.aboutlink {
    text-align: center;
    color: red;
    }
    This can be done many other ways so this is just one.

    You may want to dig through w3schools for more css styling info.
    {{ DiscussionBoard.errors[9605825].message }}
  • Profile picture of the author KateHunter
    David V's signature = funny!
    {{ DiscussionBoard.errors[9611448].message }}
  • Profile picture of the author iamjosan
    Replace your link with this
    HTML Code:
    <a href="about.html" id="about">about</a>
    {{ DiscussionBoard.errors[9613120].message }}

Trending Topics