-
Jul 1st, 2014, 02:35 PM
#1
[RESOLVED] [CSS] Setting width on items in <nav>
I'm wanting to set the width of my elements inside my <nav> tag. Currently this is my HTML:
HTML Code:
<nav>
<a href='#'><span id='active'>Home</span></a>
<a href='download.html'>Download</a>
<a href='library.html'>Library</a>
<a href='forum.html'>Forums</a>
</nav>
This is what I'm trying:
Code:
nav {
width: 100%;
}
nav a {
text-align: center;
width: 25%;
}
What I'm expecting to happen is the links will be 1/4 the size of the navigation, but that's not happening. Currently all the links are aligned to the left of the nav element.
Last edited by dday9; Jul 1st, 2014 at 02:40 PM.
-
Jul 1st, 2014, 03:59 PM
#2
Re: [CSS] Setting width on items in <nav>
You can either set the anchors to display as inline-block, or you can set them to display as block and float them. Both of those should make your elements line up one next to the other.
-
Jul 1st, 2014, 04:01 PM
#3
Re: [CSS] Setting width on items in <nav>
Ah ok. I don't know why I didn't think of setting the display... Thanks kfcSmitty!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|