首页 > 解决方案 > 你如何制作一个覆盖整个屏幕顶部的 div?以及如何插入将填充整个 div 的图像?

问题描述

我目前正在练习,但我似乎无法让它发挥作用。

我会给出一些代码,但不知道如何缩进代码,所以为此使用这个 jpg。

https://roco.studio/wp-content/uploads/2014/12/img_banner-thin_mountains.jpg

标签: htmlcss

解决方案


.img-wrapper{
width:100%;}
.img-wrapper img{
width:100%;
}
<div class="img-wrapper">
  <img src="https://roco.studio/wp-content/uploads/2014/12/img_banner-thin_mountains.jpg" />
</div>


推荐阅读