2012-10-03 63 views
1

我試圖創建HTML日曆,並試圖給每個單元格的寬度和高度設置爲100。爲此,我用下面的風格標籤嘗試。但由於某種原因,每個單元的高度和寬度都不會改變。但是,而不是指定樣式標籤中的屬性,如果我嘗試修改具有寬度/高度屬性的單個單元格它的作品。請幫忙。HTML設置寬度和高度不起作用

<html> 
<head> 
    <style type="text/css"> 
    td {color:green; width:100; height:100} 
    th {width:100} 
    </style> 
</head> 
<body> 
<table border="2"> 
<caption> October 2012 Calendar</caption> 
    <tr> 
    <th> Sunday </th> 
    <th> Monday </th> 
    <th> Tuesday </th> 
    <th> Wednesday </th> 
    <th> Thursday </th> 
    <th> Friday </th> 
    <th> Saturday </th> 
    </tr> 
    <tr> 
    <td bgcolor="grey"> &nbsp; </td> 
    <td>1</td> 
    <td>2</td> 
    <td>3</td> 
    <td background="../worldanimalday.jpg">4</td> 
    <td>5</td> 
    <td>6</td> 
    </tr> 
</table> 
</body> 
</html> 

回答

2

............................................ ................

你的CSS 問題正確的CSS因爲這樣

更換這個CSS

td {color:green; width:100; height:100;} 
    th {width:100;} 

分成

td {color:green; width:100px; height:100px;} 
    th {width:100px;} 
+0

哇!這就是訣竅。非常感謝你! – sachin2182