I'm using font awesome library. I would like to put horizontally center the Arrow icon. And DIVs must be absolute position.
I use this code but it doesn't work.
.arrow {
left: 0;
right: 0;
}
I'm using font awesome library. I would like to put horizontally center the Arrow icon. And DIVs must be absolute position.
I use this code but it doesn't work.
.arrow {
left: 0;
right: 0;
}
Use width:100%
in absolute div
.home .center {
position: absolute;
bottom: 0;
top:30px;
text-align: center;
width:100%;
}
Updated fiddle
Here is working example. You can delete .arrow css rule because it does nothing.
.home {
margin: 0 auto;
height: 100%;
width: 100%;
position: relative;
margin: 0 auto;
max-width: 960px;
}
.home .center {
position: absolute;
width: 100%;
bottom: 0;
top:30px;
text-align: center;
}
Try this:
HTML Code:
<div class="home">
<div class="center">
<a class="arrow fa fa-long-arrow-down fa-3x" href="#"></a>
</div>
</div>
CSS code:
.home {
margin: 0 auto;
height: 100%;
width: 100%;
position: relative;
margin: 0 auto;
max-width: 960px;
}
.home .center {
position: absolute;
bottom: 0;
top:30px;
text-align: center;
}
.arrow {
}
This should work,try it.
.home {
margin: 0 auto;
height: 100%;
width: 100%;
position: absolute;
margin: 0 auto;
max-width: 960px;
}
.center {
position: relative;
bottom: 0;
top:30px;
text-align: center;
}
.arrow
left: 0;
right: 0;
As an explanation why it works: well,the wrapper div must be absolute,and its content has to be relative to position what is inside of the wrapper as you please.In this way,will be easier for you if you want to add further relative divs
I just changed into your CSS, and it works fine.
.home {
margin: 0 auto;
}
.home .center {
margin: 0 auto;
text-align: center;
}
.arrow
margin: 0 auto;
}
Cheers!