【发布时间】:2019-11-24 21:42:53
【问题描述】:
<!DOCTYPE html>
<html>
<head>
<title>HTML, CSS and JavaScript demo</title>
<link rel="stylesheet" href="profilepage.css">
</head>
<body>
<!-- Start your code here -->
<div class="profile-box">
<div class="bg">
<img src="https://www.capisol.co.za/wp-content/uploads/gaussian-blur-orange-367347-background-wallpapers.jpg" />
</div>
</div>
<!-- End your code here -->
</body>
</html>
profilepage.css
.bg {
width: 100%;
height: 10%;
}
这样出来:在我的页面上
我想要的是覆盖整个第一行的宽度和页面的 10% 的高度。即
黑线结束img的地方
我一直在玩宽度和高度,但没有任何效果。在我改变宽度的那一刻,一些大的东西出现了。即使我让宽度更小。我不知道为什么宽度会改变高度。我究竟做错了什么?
【问题讨论】:
-
将图片设为背景图片。