Reputation: 3
My english is bad, so i try you to explain my problem on the picture :)
My problem: Click!
My html:
<p>Some text</p>
<div class='videobox'>
<img id='thumb' src='http://img.youtube.com/vi/ILw2sAT8mro/maxresdefault.jpg'>
<img id='button' src='http://android.batarin.zp.ua/keddrreader/YouTube-icon-full_color.png'>
</div>
<p>Some text</p>
My css:
img{
width: 100%;
}
.videobox{
position: relative;
}
#thumb{
width: 500px;
position: absolute;
}
#button{
width: 500px;
position: absolute;
}
p{
position: relative;
}
Can somebody help me with my problem?
Upvotes: 0
Views: 1775
Reputation: 1031
You can set a <p>
for child like this...
Here is your answer
CSS
p:last-child {
position: relative;
display: -webkit-box;
height: 100%;
width: 100%;
margin-top: 60%;
}
Also you can assign this code for all paragraph after image
CSS
#p{
position: relative;
display: -webkit-box;
height: 100%;
width: 100%;
margin-top: 60%;
}
Upvotes: 0
Reputation: 1695
Just change your code from
#thumb{
width: 500px;
position: absolute;
}
to
#thumb{
width: 500px;
position: relative;
}
here is a jsfiddle link
Upvotes: 1
Reputation: 11052
I don't think I'd do it the way any of the answers have suggested except for changing the button to relative
so here's my answer:
Basically, give a height to the videobox
div (it has zero height because of the absolute positioning).
.videobox{
position: relative;
height: 281px;
}
The 281px
is a bit of a magic number fix, I just used the height of the resized thumbnail.
Upvotes: 2
Reputation: 5503
You can change the position of the button to be relative
#button{
width: 500px;
position: relative;
}
Upvotes: 1
Reputation: 5226
Because you are absolutely positioning items. You could add this CSS to your last <p>
tag.
position: absolute;
top: 330px;
Upvotes: 0