html:
<div class="home">
<div class="home-1">
<a href="">
<div class="font-4 none-5">
<div>严选HOME@酒店</div>
</div>
<div class="font-4 none-6">
<div>严选HOME@公寓</div>
</div>
</a>
</div>
<div class="home-2">
<div class="home-3">
<div class="text">
<div class="none-1">
本期严选改造了一间北京后海民宿,希望用温暖感十足布艺软装和质感高级的家居单品,打造一个即使在繁华之内,也能让你宁静下来的后海小院
</div>
<div class="none-2">
独居的女孩子,在都市中自己与自己生活,当然希望居住空间里的一切都精致的顺你心意,能够好好抚慰工作后疲惫的身体。想要守护你的这种精致,本期严选HOME与万科泊寓再次合作,用高级灰加上低饱和度的粉色,搭配真丝、香薰这些好物,为你打造出有质感的女神范单身公寓。
</div>
</div>
<a href="">
<div><img src="weiNiYanXuan-image/kongjian1.jpg" alt=""></div>
<div><img src="weiNiYanXuan-image/kongjian2.jpg" alt=""></div>
</a>
</div>
</div>
</div>
css:
.home{
color: #333;
overflow: hidden;
}
.home-1{
height: 72px;
color: #666;
line-height: 70px;
text-align: center;
border-left: 1px solid #eaeaea;
}
.font-4{
width: 543px;
float: left;
color: #333;
border: 1px solid #eaeaea;
background-color: #fff;
/*border-bottom-color: #fff;*/
border-left: none;
font-size: 18px;
line-height: 70px;
text-align: center;
font-weight: bold;
}
.font-4 div{
margin: 0 auto;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/*.home-1 a .font-4 div:hover{*/
/*color:#b4a078 ;*/
/*background-color: #ccc;*/
/*}*/
.home-2{
position: relative;
border: 1px solid #eaeaea;
border-top: none;
padding: 40px 75px 0px 75px;
height: 601px;
}
.text{
margin-bottom: 30px;
height: 40px;
text-align: left;
}
.text div{
margin-left: 45px;
height: 40px;
font-size: 14px;
color: #333;
line-height: 20px;
text-align: left;
}
.home-3 a{
display: block;
width: 940px;
height: 450px;
position: relative;
}
.none-1{
display: block;
}
.none-2{
position: absolute;
top: 0px;
margin-top: 40px;
margin-right: 75px;
display: none;
}
.none-4 img{
position: absolute;
bottom: 450px;
display: none;
}
.none-6:hover{
color:#b4a078 ;
background-color: #ccc;
}
.none-6:hover .none-1{
display: none;
}
.none-6:hover .none-2{
display: none;
}
代码有些乱还请多多包涵
先上结论:如果dom结构改一改也是可以的
但是hover到外面就会显示home1的内容,而不是hover到header1上再显示home1的内容,体验感并不好