我有以下css:
.horizontal-holder1{
float:left;
width:88px;
height:98px;
margin-bottom:15px;
border:1px solid #bdbdbd;
background-color:grey;
}
.white-holder{
width:88px;
height:49px;
background-color:white;
float:left;
.yellow-holder{
width:88px;
height:49px;
background-color:#FFF8DC;
float:left;
}
.player-holder{
width:60px;
height:49px;
float:left;
}
.score-holder{
width:28px;
height:49px;
float:left;
}
以下html:
<div class="horizontal-holder1">
<div class="white-holder">
<div class="player-holder">
<? echo $data['username']; ?>
</div>
<div class="score-holder">
0
<div>
</div>
<div class="yellow-holder">
<div class="player-holder">
<? echo $data['username']; ?>
</div>
<div class="score-holder">
0
<div>
</div>
</div>
问题是黄色支架没有漂浮在白色支架下方,它向右移动。
任何人都可以看到这个原因吗?
由于
答案 0 :(得分:1)
“score-holder”语法的可能问题
<div class="score-holder">
0
<div>
结束<div>
标记没有结束标记斜杠(/
)
看起来没问题: jsfiddle example
答案 1 :(得分:0)
.score-holder
.yellow-holder
.second-team-holder
)。float:left
放在任何地方?}
CSS定义.yellow-holder
醇>
答案 2 :(得分:0)
您在某些结束标记中遗漏了/
,而在CSS中遗漏了}
。
<div class="horizontal-holder1">
<div class="white-holder">
<div class="player-holder">
<? echo $data['username']; ?>
</div>
<div class="score-holder">
0
</div> <!-- here -->
</div>
<div class="yellow-holder">
<div class="player-holder">
<? echo $data['username']; ?>
</div>
<div class="score-holder">
0
</div> <!-- and here! -->
</div>
</div>
.horizontal-holder1{
float:left;
width:88px;
height:98px;
margin-bottom:15px;
border:1px solid #bdbdbd;
background-color:grey;
}
.white-holder{
width:88px;
height:49px;
background-color:white;
float:left;
} /* whoops! */
.yellow-holder{
width:88px;
height:49px;
background-color:#FFF8DC;
float:left;
}
.player-holder{
width:60px;
height:49px;
float:left;
}
.score-holder{
width:28px;
height:49px;
float:left;
}