2010-10-21 61 views
2

如何翻譯下面的代碼以使用三個div並且看起來相同?表格對div問題

<table width="1050px"> 
     <tr> 
     <td rowspan="2" width="80%"></td> 
     <td width="20%"><p>some text</p></td> 
     </tr> 
     <tr> 
     <td><p>some text</p></td> 
     </tr> 
    <table> 
+3

而不是得到它*翻譯的*,你需要學習CSS,你將需要反正知道它:) – Sarfraz 2010-10-21 18:46:04

+0

如果工作作爲一個表,把它作爲一個表。 – DwB 2010-10-21 18:46:35

+3

@dwb - 什麼!除非是表格數據,否則不應該是表格。 – 2010-10-21 18:49:06

回答

5

沒有rowspan,但是你可以實現與以下相同的結果:

<div style="width: 1050px;"> 
    <div style="width: 80%; float: left;"> 
     <p>some text</p> 
    </div> 
    <div style="width: 20%; float: left;"> 
     <p>some text</p> 
    </div> 
    <div style="width: 100%; clear: left;"> 
     <p>some text</p> 
    </div> 
</div> 

See working example.

0

這裏的幾乎是相同的答案達斯汀帶一點顏色拋出使用右列中的列表。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
    <html> 
    <head> 
     <title>Default</title> 
     <style type="text/css" media="all"> 
ul { list-style-type: none; 
margin-left: 0; 
padding-left: 0;} 
</style> 
    </head> 
    <body> 
<table width="1050px"> 
     <tr> 
     <td rowspan="2" width="80%" >a</td> 
     <td width="20%" style="background-color: yellow;"><p>some text</p></td> 
     </tr> 
     <tr> 
     <td style="background-color: yellow;"><p>some text</p></td> 
     </tr> 
    <table> 
<div style="width: 1050px;"> 
    <div style="width: 80%;float: left;">a</div> 
    <div style="width: 20%; float: left; background-color: yellow;"> 
<p>some text using paragraphs</p><p>some text</p> 
<ul> 
<li>some text using lists</li> 
<li>some text</li> 
</ul> 
</div> 
</div> 
    </body> 
    </html> 
+0

非常感謝! – Jenny 2010-10-21 19:12:10