我想让div透明并将其移到图像上。这是html和css的示例代码:
<html>
<head>
<title></title>
<style type="text/css">
body {
width: 500px;
margin: 0 auto;
}
.head {
border: 2px solid black;
width: 346px;
height: 50px;
}
h2 {
padding: 0px;
margin: 10px;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="head">
<h2>Logo</h2>
</div>
<div class="slider">
<img src="http://placehold.it/350x150">
</div>
</div>
</body>
</html>
任何人都可以帮助我吗?在此先感谢:)
答案 0 :(得分:1)
向position: absolute
.head
所以你的代码变成了:
body {
width: 500px;
margin: 0 auto;
}
.head {
border: 2px solid black;
width: 346px;
height: 50px;
position: absolute;
}
h2 {
padding: 0px;
margin: 10px;
}
&#13;
<div class="wrapper">
<div class="head">
<h2>Logo</h2>
</div>
<div class="slider">
<img src="http://placehold.it/350x150">
</div>
</div>
&#13;