Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用div实现图片成为背景图 #5

Open
apersonw opened this issue May 19, 2019 · 0 comments
Open

使用div实现图片成为背景图 #5

apersonw opened this issue May 19, 2019 · 0 comments

Comments

@apersonw
Copy link
Owner

<div style="position:relative"><!--父div定位修改相对-->
  <!--盒子内其他的元素可写于此处,且每个div的z-index都要比图片盒子的高-->
  <div style="position:absolute;left:0;top:0"><img/></div><!--图片的盒子定位修改为绝对定位-->
</div>

注意,在使用相对定位时,无论是否进行移动,元素仍然占据原来的空间。因此,移动元素会导致它覆盖其它框。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant