2013-03-25 61 views
0

我目前正在爲我的Arma 2 Unit(88th Airborne Divsion)創建一個練習網站,我使用表頭超鏈接創建了一個簡單的導航欄,但表頭之間的空間取決於多長時間這個詞是。有沒有一種方法可以在頭文件之間創建相等的空間?表頭之間的平等空間

HTML代碼:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>88th Airborne Division</title> 
<link href="style.css" rel="stylesheet" type="text/css" /> 
</head> 
<body> 
<div id="container"> 
    <div id="banner"><img src="images/logo.png" width="680" height="125" alt="logo" /></div> 
    <div id="navbar"><table width="680" border="0"> 
    <tr> 
    <th>Home</th> 
    <th>About Us</th> 
    <th>Members</th> 
    <th>Apply</th> 
    </tr> 
</table> 
</div> 
</div> 
</body> 
</html> 

CSS代碼:

*{ 
    margin:0; 


    } 

#container { 
    height: 100%; 
    width: 100%; 
} 
#banner { 
    height: 125px; 
    width: 680px; 
    margin-left:auto; 
    margin-right:auto; 
} 


#navbar { 
    background-color:#333; 
    width: 680px; 
    height:25px; 
    margin-right: auto; 
    margin-left: auto; 
    text-align:center; 
} 
th{ 
    border-right-width:medium; 
    border-right-color:#000; 
    border-right-style:groove; 

    } 

enter image description here

+0

請注意,家是如何比我們小。 – 2013-03-25 01:57:30

回答

2

因爲table width=680的,你可以把CSS tr{ width: 170px; },或者,你可以在CSS

改變 th
tr{ 
    position: relative; /* you may put it out, maybe it will work without it */ 
} 

th{ 
    border-right-width:medium; 
    border-right-color:#000; 
    border-right-style:groove; 
    width: 25%; 
} 

它給你更靈活的大小。另外,我不知道你是否有任何額外的邊框或邊距。如果是這樣,那麼td s將不適合那25%(因爲尺寸沒有邊距,填充和邊框),所以請使用它(降低百分比,直到獲得正確的外觀)。

+1

謝謝,簡單的回答一個簡單的問題。 – 2013-03-25 02:22:51