Reputation: 79
so I have created 3 divs, each acting as a navigation, however these divs stack vertically, how can I make it so that they stack horizontally? Here's the code;
HTML;
<div class="link">
<!--nav-1-->
<div id="showmenu1" class="font-white">Click Here</div>
<div class="menu1" id="font-white" style="display: none;">This is all some random text!</div>
<!--nav-2-->
<div id="showmenu2" class="font-white">Click Here</div>
<div class="menu2" id="font-white" style="display: none;">This is all some random text!</div>
<!--nav-3-->
<div id="showmenu3" class="font-white">Click Here</div>
<div class="menu3" id="font-white" style="display: none;">This is all some random text!</div>
</div>
CSS;
.link {
display: inline;
padding: 2px;
letter-spacing: 6px;
text-align: center;
}
Upvotes: 0
Views: 65
Reputation: 4723
What about float:left
or inline-block
. Like in the examples down here.
.link div{float:left;}
or
.link div{display:inline-block;}
Upvotes: 2
Reputation: 9460
Added this to your CSS
.font-white
{
display: inline-block;
float:left;
}
Changed this in your CSS:
.link {
display: inline-block;
}
Output:
Upvotes: 0
Reputation: 12027
Just add display: inline
to the div elements:
.link div {
display: inline;
}
Fiddle: http://jsfiddle.net/ZyN84/
In addition, the display: inline
within the .link
class is not necessary unless you plan on having the container of the divs aligned with other elements in the same manner:
Fiddle: http://jsfiddle.net/ZyN84/1/
Upvotes: 2