Relatively positioned top not working as expected
P粉566048790
P粉566048790 2023-10-29 21:02:46
0
1
618

Why the top attribute of does not work when the label is the same level as

, but This works if I remove the tag

.


html,
body {
  height: 100%;
}

img {
  position: relative;
  top: 40%;
}
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Temporibus delectus accusantium nulla eveniet aperiam, quo odit qui voluptas. Illo vel sed ex dolores illum eum architecto a libero atque. Voluptatibus.</p>
<img src="http://lorempixel.com/400/200/" alt="">


P粉566048790
P粉566048790

reply all(1)
P粉521013123

http://jsfiddle.net/9bxwxfe2/

Use a container div set to position:relative; and then add position:absolute; to the img.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template