Reputation: 29
I made a navigation bar with some links on it and a header, just like bootstrap, but I'm trying to make it so the account dropdown is on the right side, but when I add the class "pullRight" it moves it to the right but doesn't stay on the navigation bar.
pullright CSS
.pullRight {
float: right;
}
HTML
<ul>
<li><a href="#"><i class="fa fa-comments"></i> Forums</a></li>
<li><a href="#"><i class="fa fa-trophy"></i> Players</a></li>
<li><a href="#"><i class="fa fa-shopping-cart"></i> Shop</a></li>
<li class="pullRight"><a href="#"><i class="fa fa-user"></i> Account</a></li>
</ul>
Navigation bar CSS
.navigationBar {
width: 100%;
height: 40px;
background: #efefef;
background: -moz-linear-gradient(top, #efefef 50%, #d3d3d3 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(50%,#efefef), color-stop(100%,#d3d3d3));
background: -webkit-linear-gradient(top, #efefef 50%,#d3d3d3 100%);
background: -o-linear-gradient(top, #efefef 50%,#d3d3d3 100%);
background: -ms-linear-gradient(top, #efefef 50%,#d3d3d3 100%);
background: linear-gradient(to bottom, #efefef 50%,#d3d3d3 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#efefef', endColorstr='#d3d3d3',GradientType=0 );
border-bottom: 2px solid #EB7727;
}
.navigationBar ul {
list-style: none;
}
.navigationBar ul li {
width: 100px;
height: 40px;
background: #efefef;
background: -moz-linear-gradient(top, #efefef 50%, #d3d3d3 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(50%,#efefef), color-stop(100%,#d3d3d3));
background: -webkit-linear-gradient(top, #efefef 50%,#d3d3d3 100%);
background: -o-linear-gradient(top, #efefef 50%,#d3d3d3 100%);
background: -ms-linear-gradient(top, #efefef 50%,#d3d3d3 100%);
background: linear-gradient(to bottom, #efefef 50%,#d3d3d3 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#efefef', endColorstr='#d3d3d3',GradientType=0 );
border-bottom: 2px solid #EB7727;
text-align: center;
border-right: 1px solid gray;
display: table-cell;
cursor: pointer;
}
.navigationBar ul li:first-child {
border-left: 1px solid gray;
}
.navigationBar ul li:hover {
border-right: 1px solid gray;
display: table-cell;
width: 100px;
height: 40px;
background: rgb(211,211,211); /* Old browsers */
background: -moz-linear-gradient(top, rgba(211,211,211,1) 0%, rgba(239,239,239,1) 50%, rgba(211,211,211,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(211,211,211,1)), color-stop(50%,rgba(239,239,239,1)), color-stop(100%,rgba(211,211,211,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(211,211,211,1) 0%,rgba(239,239,239,1) 50%,rgba(211,211,211,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(211,211,211,1) 0%,rgba(239,239,239,1) 50%,rgba(211,211,211,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(211,211,211,1) 0%,rgba(239,239,239,1) 50%,rgba(211,211,211,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(211,211,211,1) 0%,rgba(239,239,239,1) 50%,rgba(211,211,211,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d3d3d3', endColorstr='#d3d3d3',GradientType=0 ); /* IE6-9 */
text-align: center;
cursor: pointer;
}
.navigationBar ul li a ,
.navigationBar ul li a:hover ,
.navigationBar ul li a:active {
line-height: 40px;
color: #000;
text-decoration: none;
font-size: 14px;
font-family: "Open Sans", Helvetica, Arial, sans-serif;
cursor: pointer;
}
Upvotes: 1
Views: 68
Reputation: 1949
hopefully this helps. all i have done is added the float left to all other menu options except accounts... i also added padding 0 to the ul element to remove the leading space before forums..
.navigationBar {
width: 100%;
height: 40px;
background: #efefef;
background: -moz-linear-gradient(top, #efefef 50%, #d3d3d3 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(50%,#efefef), color-stop(100%,#d3d3d3));
background: -webkit-linear-gradient(top, #efefef 50%,#d3d3d3 100%);
background: -o-linear-gradient(top, #efefef 50%,#d3d3d3 100%);
background: -ms-linear-gradient(top, #efefef 50%,#d3d3d3 100%);
background: linear-gradient(to bottom, #efefef 50%,#d3d3d3 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#efefef', endColorstr='#d3d3d3',GradientType=0 );
border-bottom: 2px solid #EB7727;
}
.navigationBar ul {
list-style: none;
padding: 0;
}
.navigationBar ul li {
width: 100px;
height: 40px;
background: #efefef;
background: -moz-linear-gradient(top, #efefef 50%, #d3d3d3 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(50%,#efefef), color-stop(100%,#d3d3d3));
background: -webkit-linear-gradient(top, #efefef 50%,#d3d3d3 100%);
background: -o-linear-gradient(top, #efefef 50%,#d3d3d3 100%);
background: -ms-linear-gradient(top, #efefef 50%,#d3d3d3 100%);
background: linear-gradient(to bottom, #efefef 50%,#d3d3d3 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#efefef', endColorstr='#d3d3d3',GradientType=0 );
border-bottom: 2px solid #EB7727;
text-align: center;
border-right: 1px solid gray;
display: table-cell;
cursor: pointer;
}
.navigationBar ul li:first-child {
border-left: 1px solid gray;
}
.navigationBar ul li:last-child {
border-left: 1px solid gray;
}
.navigationBar ul li:hover {
border-right: 1px solid gray;
display: table-cell;
width: 100px;
height: 40px;
background: rgb(211,211,211); /* Old browsers */
background: -moz-linear-gradient(top, rgba(211,211,211,1) 0%, rgba(239,239,239,1) 50%, rgba(211,211,211,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(211,211,211,1)), color-stop(50%,rgba(239,239,239,1)), color-stop(100%,rgba(211,211,211,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(211,211,211,1) 0%,rgba(239,239,239,1) 50%,rgba(211,211,211,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(211,211,211,1) 0%,rgba(239,239,239,1) 50%,rgba(211,211,211,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(211,211,211,1) 0%,rgba(239,239,239,1) 50%,rgba(211,211,211,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(211,211,211,1) 0%,rgba(239,239,239,1) 50%,rgba(211,211,211,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d3d3d3', endColorstr='#d3d3d3',GradientType=0 ); /* IE6-9 */
text-align: center;
cursor: pointer;
}
.navigationBar ul li a ,
.navigationBar ul li a:hover ,
.navigationBar ul li a:active {
line-height: 40px;
color: #000;
text-decoration: none;
font-size: 14px;
font-family: "Open Sans", Helvetica, Arial, sans-serif;
cursor: pointer;
}
.pullRight{
float:right;
}
.pullLeft{
float:left;
}
<div class="navigationBar">
<ul>
<li class="pullLeft"><a href="#"><i class="fa fa-comments"></i> Forums</a></li>
<li class="pullLeft"><a href="#"><i class="fa fa-trophy"></i> Players</a></li>
<li class="pullLeft"><a href="#"><i class="fa fa-shopping-cart"></i> Shop</a></li>
<li class="pullRight"><a href="#"><i class="fa fa-user"></i> Account</a></li>
</ul>
</div>
Hopefully this is what you were looking to do...have a gr8 day
Upvotes: 1