我想要設計比賽支架的視覺效果,但它不能很好地插在一起!設計比賽支架 - 不能很好地吻合
的CSS如下:
#tournament-holder{
width:708px;
padding:20px 0 20px 15px;
float:left;
}
.vertical-holder{
width:100px;
padding-right:15px;
float:left;
}
.horizontal-holder1{
width:98px;
height:98px;
margin-bottom:15px;
border:1px solid #bdbdbd;
float:left;
}
.horizontal-holder2{
width:98px;
height:98px;
margin:57.5px 0 72.5px 0;
border:1px solid #bdbdbd;
float:left;
}
.horizontal-holder3{
width:98px;
height:98px;
margin:172.5px 0 187.5px 0;
border:1px solid #bdbdbd;
float:left;
}
.horizontal-holder4{
width:98px;
height:98px;
margin:402.5px 0 417.5px 0;
border:1px solid #bdbdbd;
float:left;
}
.horizontal-holder5{
width:98px;
height:98px;
margin:862.5px 0 877.5px 0;
border:1px solid #bdbdbd;
float:left;
}
.horizontal-holder6{
width:98px;
height:98px;
margin:1782.5px 0 1797.5px 0;
border:1px solid #bdbdbd;
float:left;
}
.white-holder{
width:98px;
height:49px;
background-color:white;
float:left;
}
.yellow-holder{
width:98px;
height:49px;
background-color:#FFF8DC;
float:left;
}
.player-holder{
width:70px;
height:49px;
float:left;
}
.score-holder{
width:28px;
height:49px;
float:left;
}
現在的HTML:
<div id="tournament-holder">
<div class="vertical-holder">
<?php
$q = "SELECT u.username, p.position FROM ".TBL_FOOT_TOUR_PLAYERS." p
INNER JOIN ".TBL_USERS." u ON p.userid = u.id
WHERE p.tourid = '$tour_id' ORDER BY position";
$result = $database->query($q);
$i = 1;
while($row=mysql_fetch_assoc($result)){
extract($row);
if($i&1){
?>
<div class="horizontal-holder1">
<div class="white-holder">
<div class="player-holder">
<? echo "$username"; ?>
</div>
<div class="score-holder">
0
<div>
</div>
<?php
}
else{
?>
<div class="yellow-holder">
<div class="player-holder">
<? echo "$username"; ?>
</div>
<div class="score-holder">
0
<div>
</div>
</div>
<?php
}
$i++;
}
?>
</div>
<?php
//subsequent rounds
for($i=1; $i <= $rounds; $i++)
{
$j = $i + 1; //this is to generate the correct horizontal holder
$k = 1; //this is the order of the players - to check if they are odd or even as they come out.
$players = $players/2;
$q = "SELECT u.username, r.position FROM ".TBL_FOOT_TOUR_ROUNDS." r
INNER JOIN ".TBL_USERS." u ON u.id = r.winner
WHERE tourid = '$tour_id' && round = '$i' ORDER BY position";
$result = $database->query($q);
?>
<div class="vertical-holder">
<?php
while($row=mysql_fetch_assoc($result)){
extract($row);
if($k&1){
?>
<div class="horizontal-holder<?php echo $j; ?>">
<div class="white-holder">
<div class="player-holder">
<? echo "$username"; ?>
</div>
<div class="score-holder">
0
<div>
</div>
<?php
}
else{
?>
<div class="yellow-holder">
<div class="player-holder">
<? echo "$username"; ?>
</div>
<div class="score-holder">
0
<div>
</div>
</div>
<?php
}
$k++;
}
?>
</div>
<?php
}
?>
</div>
下面是什麼支架目前呈現爲鏈接:
顯然,有些東西沒有正確排列。
支架的想法是'錦標賽持有人'將持有整體支架。每輪將有一個'垂直持有人'...每個垂直持有人將包含水平持有人爲每2隊(1夾具)。隨着錦標賽的進一步發展,6個不同的水平持有者可以獲得不同的賽程間距。在每個水平支架中,會有一個黃色或白色支架。兩者都是一樣的,只是不同的背景顏色。其中每一個將是一個球員和得分持有者。
我知道這是一個相當複雜的問題來回答,但可以解答這個問題嗎? 我有重大問題,只是無法解決問題。
謝謝:)
感謝您的答覆,只是讀之前,我意識到爲什麼我的顯示不正確,因爲if語句導致div標籤在錯誤的階段被關閉,導致混亂,所以我決定使用一個數組,然後看看你寫的是什麼,主要區別在於你使用的是數組,我將把它放在我的解決方案中,希望它能爲我找到一些結構!非常感謝你的回答,真的很有幫助。會發布我的結果:) – sark9012 2012-01-10 15:36:28