0

I face a problem setting custom font-size in css document. Here's my problem. I use nav tag of html5. Where do I have to place the font-size attribute?

Here's part of my codeQ

Part of html code:

<div id="nav">
        <nav>
            <ul>
                <li>
                    <a href="#">ΑΡΧΙΚΗ</a>
                </li>
                <li>
                    <a href="#">ΥΠΗΡΕΣΙΕΣ</a>
                </li>
                <li>
                    <a href="#">ΒΙΟΓΡΑΦΙΚΟ</a>
                </li>
                <li>
                    <a href="#">ΕΠΙΚΟΙΝΩΝΙΑ</a>
                </li>
            </ul>
        </nav>
    </div>

Part of my css code:

#nav {

    width: 30%;
    margin:0 auto;

}

nav>ul {
    list-style: none;       
}

nav>ul>li { 

    display: inline;
}

nav>ul>li>a {
    font-family: "Comfortaa Thin", Comfortaa;
    color:#807f7f;          
}
2
  • 1
    It can be anywhere inside the nav, or #nav{font-size:20px}.
    – Stickers
    Jul 12, 2015 at 23:11
  • It depends on your styles already defined. Because, for example. if you set #nav {font-size:20px} but you already have a selector for links (a {font-size: 12px}, it won't override it.
    – Mindastic
    Jul 12, 2015 at 23:27

2 Answers 2

0

You can apply font-size to any container element including nav itself

nav {
  font-size: 40px;
}
#nav {
  width: 30%;
  margin: 0 auto;
}
nav>ul {
  list-style: none;
}
nav>ul>li {
  display: inline;
}
nav>ul>li>a {
  font-family: "Comfortaa Thin", Comfortaa;
  color: #807f7f;
}
<div id="nav">
  <nav>
    <ul>
      <li>
        <a href="#">ΑΡΧΙΚΗ</a>
      </li>
      <li>
        <a href="#">ΥΠΗΡΕΣΙΕΣ</a>
      </li>
      <li>
        <a href="#">ΒΙΟΓΡΑΦΙΚΟ</a>
      </li>
      <li>
        <a href="#">ΕΠΙΚΟΙΝΩΝΙΑ</a>
      </li>
    </ul>
  </nav>
</div>

0
nav>ul>li>a {
    font-family: "Comfortaa Thin", Comfortaa;
    color:#807f7f;
    font-size: /*write here*/;          
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.