html - How do I position a div below an image with changing height? -
in new site have image set width 100% , text underneath that. how change position of text based on height of image?
html:
<div class = "pic"> <img src="#"/> </div> <div class ="text"> <h3>some important message</h3> </div> css:
.pic{ position:absolute; left:0; width:100%; } .pic img{ position:absolute; width:100%; } .text{ position:relative; margin-top:10px; } as requested, here fiddle https://jsfiddle.net/slx3n2vz/
please try this:
remove css , add only
.pic{ width:100%; } .pic img{ width:100%; } .text{ margin-top:10px; } the way positioning html element wrong. please correct it.
Comments
Post a Comment