Dziubutkus Dziubutkus - 3 months ago 5
CSS Question

Can't place div on the same line as a vertical menu(other div)

I want to place div on the same line as the menu, but it always sits at the bottom of the menu, gets pushed by the other div. Postion: absolute on #slider id did not help.

Jsfiddle

HTML

<div id=wrap>
<nav>
<ul>
<li class="var_nav">
<div class="link_bg"></div>
<div class="link_title">
<div class="icon">
<i class="fa fa-home fa-2x"></i>
</div>
</div>
</li>
</ul>
</nav>






I tried to place display property, tried changing floats nothing helped and couldnt find something similar like this on the internet.
CSS

ul
{
margin:0px;
padding:0px;
list-style-type:none;
-webkit-backface-visibility: hidden; backface-visibility: hidden;

}
.var_nav
{

position:relative;
width:300px;
height:70px;
margin-bottom:5px;
background-color: #fff;
}
.link_bg
{
width:70px;
height:70px;
position:absolute;
background:#373541;
z-index:2;
}
.link_bg i
{
position:relative;
}
.link_title
{
position:absolute;
width:100%;
z-index:3;
color:#bc7c45;
}
.link_title:hover .icon
{
-webkit-transform:rotate(360deg);
-moz-transform:rotate(360deg);
-o-transform:rotate(360deg);
-ms-transform:rotate(360deg);
transform:rotate(360deg);
}
.var_nav:hover .link_bg
{
width:100%;
background:#373441;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
.var_nav:hover a
{
font-weight:bold;
-webkit-transition:all .5s ease-in-out;
-moz-transition:all .5s ease-in-out;
-o-transition:all .5s ease-in-out;
-ms-transition:all .5s ease-in-out;
transition:all .5s ease-in-out;
}
.icon
{
position:relative;
width:70px;
height:70px;
text-align:center;
color:#bc7c45;
-webkit-transition:all .5s ease-in-out;
-moz-transition:all .5s ease-in-out;
-o-transition:all .5s ease-in-out;
ms-transition:all .5s ease-in-out;
transition:all .5s ease-in-out;
float:left;
}
.icon i{top:22px;position:relative;}
a{
display:block;
position:absolute;
float:left;
font-family:arial;
font-size: 18px;
color:#bc7c45;
text-decoration:none;
width:100%;
height:70px;
text-align:center;
}
span
{
margin-top:25px;
display:block;
}
#slider
{
background:#373441;
width: 1000px;
height: 550px;
float: right;
}

Answer

You want to get #slider next to nav?

Just add class like around_nav to nav tag:

.around_nav
{
  float: left;
}

Updated fiddle

Comments