div1包含div2和div3
div3 div2同时浮动到最右边.
div3 不显示
设置鼠标触动效果
当鼠标触动事件,显示div3,
同时把div2挤到左边。
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
.div1
{
height: 50px;
width: 300px;
background-color: yellow;
}
.div1:hover .div3{
display: block;
}
.div2
{
width: 100px;
background-color: red;
height: 50px;
float: right;
}
.div3
{
width: 100px;
background-color: blue;
height: 50px;
float: right;
display: none;
}
</style>
</head>
<body>
<div class="div1">
<div class="div3">3</div>
<div class="div2">2</div>1
</div>
</body>
</html>
时间: 2024-11-10 01:18:23