html - Centering absolute element inside fixed width container -


i have fixed size parent image , absolute element of text nested inside.

i .video-text center off browser window size , not fixed width of parent div.

html:

<div class="video-bg">     <img src="../images/video-bg.jpg" />     <div class="video-text ">        <a href="#"><h3> watch video learn more</h3></a>     </div> </div> 

css:

.video-bg {     position: relative;     overflow: hidden;     width: 1280px; } .video-bg img {     width: 100%; } .video-text {     position: absolute;     top: 44%;     left: 50%; } 

try setting position static rather relative.

an element position: static; not positioned in special way; positioned according normal flow of page.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -