I have an issue regarding the following CSS setting:
How to set an element vertically center?
.cycle-overlay { position:absolute; top:0; left:0; }
I have an issue regarding the following CSS setting:
How to set an element vertically center?
.cycle-overlay { position:absolute; top:0; left:0; }
The common way to do this is take the object to 50% from the top and then margin it 50% of the width of the object back:
.cycle-overlay{
position: absolute;
left: 0px;
width: 100%;
top: 50%;
height: (for example) 100px;
margin-top: (-height/2 that means:) -50px;
}
finaly if u want to have the DIV fixed at the position set the Position to absolute
Use like this. You need to specify negative margin-top
with half of your div height. Here i have assumed your div have a height of 200px.
.cycle-overlay { position:absolute; top:50%; left:0; margin-top:-100px; }
First of all you need to set height for a absolute positioned
element to make it vertically align middle
.cycle-overlay{
position:absolute;
top:0;
bottom:0;
right:0;
left:0;
margin:auto;
height:20px;
}
NOTE: TOP, LEFT, RIGHT and BOTTOM accepts only numeric values.