0
我試圖在懸停時更改.space顏色。它從紅色開始,但是當懸停在包括圖像在內的整個區域時,紅色部分應該變黑。那可能嗎?有懸停時改變顏色
.space {
background: red;
width:100%;
height:auto;
display:block
}
.space a:hover {
\t background-color: #000;
\t text-decoration: none;
\t -moz-transition: .6s ease-in-out;
\t -webkit-transition: .6s ease-in-out;
\t -o-transition: .6s ease-in-out;
\t -ms-transition: .6s ease-in-out;
\t transition: .6s ease-in-out;
}
.img {
float: right;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<a href="#" class="space">
<img src="https://placeimg.com/100/100/any">
<p>The biggest car</p>
</a>