問題是在代碼中有2格,當鼠標進入第一個div的背景顏色是變化的,當進入第二個div兩個背景顏色,現在我想的是改變的時候進入第一div的背景色都是變化的!1 DIV DIV同時改變背景顏色懸停
.aboutboth {
\t width: 370px;
\t margin: 0 auto;
}
.about-mohamad {
\t margin: 0 auto;
\t width: 170px;
\t height: 230px;
\t background: #666666;
\t float: left;
\t text-align: center;
\t margin-right: 30px;
\t -webkit-transition: all .5s linear ;
\t -moz-transition: all .5s linear ;
\t -o-transition: all .5s linear ;
\t transition: all .5s linear ;
\t position: relative;
}
.about-mohamad:hover {
\t background: #e9e9e9;
}
.about-mohamad div {
\t margin: 0 auto;
\t width: 150px;
\t height: 150px;
\t background: white;
\t margin-top: 10px;
\t margin-bottom: 25px;
\t -webkit-transition: all .5s linear ;
\t -moz-transition: all .5s linear ;
\t -o-transition: all .5s linear ;
\t transition: all .5s linear ;
}
.about-mohamad div:hover {
\t background: #2d3030;
}
.about-mohamad span {
\t display: inline;
\t font-size: 13px;
\t display: inline-block;
\t color: white;
}
.about-mohamad p {
\t font-size: 10px;
}
.about-mohamad div img {
\t margin-top: 25px;
}
.about-mohamad span#abouthovera {
display:inline;
text-transform: uppercase;
font-size: 10px;
}
.about-mohamad:hover span#abouthovera {
display:none;
}
.about-mohamad span#abouthoverb {
display:none;
}
.about-mohamad:hover span#abouthoverb {
display:inline;
color: #666666;
text-transform: uppercase;
font-size: 10px;
}
<div class="aboutboth">
<div class="about-mohamad">
<div><img src="http://rezaaria.com/1.png"></div>
\t \t <span id="abouthovera">job</span>
\t \t <span id="abouthoverb">name</span>
\t </div>
</div>
你如何解決這個問題?請你解釋一下。 – 2014-11-22 10:45:28
你只需要改變'。關於-穆罕默德格:hover'爲'。關於-穆罕默德:懸停div'。 – emmanuel 2014-11-22 10:46:25
[鏈接](http://stackoverflow.com/questions/27769432/position-fixed-with-100-height)能不能幫我找到解決辦法嗎? – 2015-01-06 11:06:03