2016-07-22 4 views
-2

私は小さなスタートアップのためにウェブサイトを作っています。今、私は、背景色が白である中央領域と、背景色が薄い灰色である中央領域を作りたいと思っています。私は、背景色が白のテーブルを作り、中央に配置しましたが、ページの一番下に表示されます。何が起こっている?ここでテーブルにHTMLコンテンツが表示されない

<html> 
<head> 
<title>Memocups</title> 

</head> 
<body bgcolor="#d9d9d9"> 
<table align="center" width="50%" bgcolor="#ffffff"> 
<tr> 
<p><h1>Memocups</h1><p> 
<p><h3>What is a memocup?<h3><p> 
    <img src="images/img_1_cuponstump.jpg" width="540px" height="360px"> 
<p> 
    A memocups is a coffe mug wich has a customizable picture!<br> What makes memocups unique from all other mugs with pictures is <br>that you upload the picture you want to our website and we<br> will put it on the mug! So what are you waiting for the<br>perfect gift is only a few clicks away!</p> 
</tr> 
</table> 
</body> 
</html> 
+2

、あなたは 'td'を逃している(http://www.w3schools.com/html/html_tables [ここで見てみます] .asp)。また、表形式のデータをレイアウトしていない場合は、テーブルを使用しないでください。 – APAD1

+0

あなたのHTMLは全面的に無効です。 – j08691

+0

ここから始めてください:http://validator.w3.org/nu/ – Quentin

答えて

0

3列2列のシンプルな表。テーブルの正しい形式ではありません

<table border=1> 
 

 
    <tr> 
 
     <td>cell 1<td> 
 
     <td>cell 2</td> 
 
     <td>cell 3</td> 
 
    </tr> 
 

 
    <tr> 
 
     <td>cell 4<td> 
 
     <td>cell 5</td> 
 
     <td>cell 6</td> 
 
    </tr> 
 

 
</table>

0

は、テーブルの書式設定方法です。

<table width="50%" style="background-color:#fff;margin:0 auto;"> 
 
\t <tr> 
 
\t \t <td> 
 
\t \t \t <h1>Memocups</h1> 
 
\t \t \t <h3>What is a memocup?</h3> 
 
\t \t \t <img src="images/img_1_cuponstump.jpg" width="540px" height="360px"> 
 
\t \t \t <p>A memocups is a coffe mug wich has a customizable picture!<br> What makes memocups unique from all other mugs with pictures is <br>that you upload the picture you want to our website and we<br> will put it on the mug! So what are you waiting for the<br>perfect gift is only a few clicks away!</p> 
 
\t \t </td> 
 
\t </tr> 
 
</table>

私は、彼らが必要とされないよう、あなたの見出しの周りにいたpタグを削除しました。また、bgcoloralignは廃止予定ですので、代わりにbackground-colormargin/floatのCSSを使用する必要があります。また、未開封h3タグを修正し、td(表のセル)を追加しました。

つまり、テーブルはこのデータに使用する正しい要素ではありません。 divを使用する必要があります。

+0

これは(データテーブルではなく)レイアウトテーブルなので、 'role =" presentation "という属性をテーブル要素に追加します。 (背景については、W3Cのドラフト「HTMLでARIAを使用する場合の注意点」(https://www.w3.org/TR/aria-in-html/#use-of-role-presentation)を参照してください)。 –

関連する問題