• 締切済み

HTMLでテーブルを作成すると上に大きなスペースが空いてしまいます。

HTMLでテーブルを作成すると上に大きなスペースが空いてしまいます。 色々ネットで検索して他の方がおっしゃる通りためしてみたのですができなくて困っています。 できないのは下記の二点です。 間違ってるところがあればご教授下さい。 1. <table width=600 border="5" bgcolor=#FFC0CB> 2. <table width=800 border=0 cellpadding=30 cellspacing=0 bgcolor=#FFB6C1><tr> <td width=0%><br></td></tr><tr> <td width=0%><br></td> <td align=left> <font color=#696969 size=3> よろしくお願いしますm(__)m

  • HTML
  • 回答数3
  • ありがとう数2

みんなの回答

  • chile5583
  • ベストアンサー率38% (44/114)
回答No.3

回答番号:No.2 で一度回答したものです。 あまりHTMLをわかっていらっしゃらないということですが、 簡単に言えば、1のタグに空間ができるようなタグは入っていません。 2のタグは <td width=0%><br></td> という意味不明なタグが入っていますのでこれは不要です。tdタグがあるのに<br>(改行)タグだけがありますから、おそらくこの<br>タグが入ったtdタグがたくさんあるんじゃないでしょうか? 2のタグを正しく書くなら、 <table width=800 border=0 cellpadding=30 cellspacing=0 bgcolor=#FFB6C1> <tr> <td align=left> <font color=#696969 size=3>テスト</font> </td> </tr> </table> こうならないといけないです。 cellpadding=30 と設定してありますので、テストという文字の周り(正確にはtdの枠の内側)に30pxの余白が上下左右にできます。 この余白をなくしたいなら、下記のようにcellpaddingの数字を減らせば行を増やしてもよけない余白が目立たなくなります。 <table width=800 border=0 cellpadding=5 cellspacing=0 bgcolor=#FFB6C1> <tr> <td align=left> <font color=#696969 size=3>テスト</font> </td> </tr> <tr> <td align=left> <font color=#696969 size=3>テスト</font> </td> </tr> <tr> <td align=left> <font color=#696969 size=3>テスト</font> </td> </tr> </table> 最初に回答したところの補足を読むと<head>タグがわからないとのことですが、HTMLの基礎ですので間違ったタグでめちゃくちゃなサイトを作らないように、最初のうちに基礎を勉強しておいた方が良いかもしれません。 <html><head><body>最初に覚えるHTMLタグはこの3つだとおもうのですが、これが分からないのにtableタグを使うと、もっと混乱してしまいます。 HTMLの基本 http://www.htmq.com/htmlkihon/004.shtml 書いたHTMLが正しいかどうかを採点してくれるサイトもあります。(かなり基礎ができていないと厳しいです) http://openlab.ring.gr.jp/k16/htmllint/htmllint.html がんばってください。

  • chile5583
  • ベストアンサー率38% (44/114)
回答No.2

<head>から</head>の間に、 <style type="text/css"><!-- table { border-collapse: collapse; margin: 0; } --></style> 上記を入れてみましょう。

jill10
質問者

補足

素人で申し訳ないのですが、もともとHeadのタグは使っていません。 headを追加で入力する場合文章として成り立つのでしょうか? また、どの部分につければよいのでしょうか?

  • zeff
  • ベストアンサー率69% (137/198)
回答No.1

タグとタグの間に全角スペースを使っていませんか? 探して削除してみてください。

jill10
質問者

お礼

確認したのですが全角スペースは入っていませんでした。。。 一体なぜでしょうか。 10行ぐらいスペースがあいてしまうのです。

関連するQ&A

  • HTMLでテーブルを縦に並べたい!

    基本的な質問でお恥ずかしいのですが、困っています。 テーブルを二つ、縦に並べたいのですが、何故か横に並んでしまいます。 どこが悪いのでしょうか?初心者ですみません…お知恵をお貸しください(T_T)。 <caption><font color="#ff0000">●</font>A <font color="#0000ff">●</font>B</font></caption> <table bgcolor="#80ffff" border="1"cellspacing="0" bordercolor="#0000ff" align="left"> <tr><th width="30"><font size="+5"><font color="#ff0000">●</font></th> <th width="150"> <font size="+4"><strong><big>C</big></strong></font></th> <td><font size="+2">D<br>E</font></td></tr> <tr><td></td><td><div align="center"> <font size="4" color="#8080ff"> 準備中</font></div></td><td></td></tr></table> </p></div> <p></p> <table align="center" bgcolor="#80ffff" height="20" width="250" border="1" cellspacing="2" cellpadding="0"> <tr><td><blink>HOME</blink></td></tr> </table> </body>

    • ベストアンサー
    • HTML
  • テーブル内にスペースができてしまうのはなぜ?

    テーブル内にさらにテーブルを入れた際、一部のセルだけ上部にスペースが空いてしまい 困っています。 下記のhtmlですが、左はテーブル内にテーブルを入れてもスペースができませんが 真ん中だけどうしても上にスペースが空いてしまいます。 全角スペースが隠れていないか確認しましたが無理でした。 ネットでもいろいろ調べましたが分かりませんでした・・・。 これは何が原因なのでしょうか? よろしくお願いします。 --------------------------------------------------------- <html> <head> </head> <body> <table border="1" width="750"> <tr><td width="150" valign="top"> <table border="1" cellspacing="0" cellpadding="0" width="140"> <tr align="center"><td bgcolor="#green">menu</td></tr> </table> </td> <td valign="top" width="480"> <table border="1" cellspacing="5" cellpadding="0" width="480"> <tr><td bgcolor="#d8de97" height="15" align="left" colspan="2">見出し</td></tr>  <tr><td bgcolor="#FFFFCC" width="240">項目名</td>  <td bgcolor="#FFFFCC" width="240">項目名</td></tr>  <tr><td bgcolor="#FFFFCC" width="240">項目名</td>  <td bgcolor="#FFFFCC" width="240">項目名</td></tr> </table> </td> <td width="120" valign="top">広告部分</td></tr> </table> </body> </html>

    • ベストアンサー
    • HTML
  • テーブルの枠の中にテーブルを設置

    TOPページに下記のような大きな4等分の枠なしテーブルを作り、中にテーブルを埋め込みたいと思っています。 <TABLE border="0" width="700" height="500"> <TR> <TD>●1</TD> <td>●2</td></TR> <TR> <TD align="left" valign="bottom">◎1</TD> <td align="center" valign="middle"> <table bordercolordark="white" bordercolorlight="black" border="1" cellpadding="8" cellspacing="0" bgcolor="greenyellow"><tr><td align="center"> <table bordercolordark="white" bordercolorlight="black" border="1" cellpadding="4" cellspacing="0" bgcolor="#ccff99"><tr><td align="center"><font color="mediumseagreen">★ ★ ★</font> おしらせ <font color="mediumseagreen">★ ★ ★</font></td></tr> <tr><td bgcolor="white"> <textarea cols="28" rows="5"> ここに文字 </textarea> </td></tr></table> <br> <table bordercolordark="white" bordercolorlight="black" border="1" cellpadding="3" cellspacing="0" bgcolor="white"><tr><td bgcolor="white"> 最終更新 ≫ </td></tr></table> </td></tr></table> </TR> </TABLE> (HEADの間にスタイルシートを挿入します。) このように書くとテーブルを入れた場所の親テーブルが大きく広がってしまいます。 広がらずにテーブルを形成する方法をご教授下さい。 初心者で申し訳ございません。

    • ベストアンサー
    • HTML
  • ヤフオクのテンプレートでバックグラウンドを使いたい

    今、オークション用のテンプレートを作ってるのですが、テーブルの背景に、 <table width="900" height="1000" border="0" cellspacing="0" cellpadding="0" background="http://000.com/000.png"> と言った感じで画像を背景に配置したいと考えていますが、どうやってもうまくいきません。 プレビュー表示の段階で、ソースコードを見てみたのですが、ちゃんと設定されているにもかかわらず、背景画像だけが表示されません。 別の方法で、 <div style="background-image:url(http://www.000.com/000.png);"> でも試して見ましたが、同じ結果でした。 背景画像の上に「商品説明」などの画像を重ねて配置したいので、どうにか上手くできる方法がありましたら是非教えて下さい。 ※上に重ねる画像だけが表示されます。 参考までに今編集中のソースを貼っておきます。 <center> <table width="900" height="1000" border="0" cellspacing="0" cellpadding="0" background="http://000.com/000.png"> <tr> <td align="center" valign="top"><br /> <center> <table width="650" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="http://000.com/001.png"></td> </tr> </table> <table width="650" border="0" cellspacing="0" cellpadding="5"> <tr> <td><font color="#a00e15"><p align="left"> 商品説明 </p></font></td> </tr> </table> <br /> <br /> <br /> <table width="650" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="http://000.com/002.png"></td> </tr> </table> <table width="650" border="0" cellspacing="0" cellpadding="5"> <tr> <td><font color="#a00e15"><p align="left"> 発送方法 </tr> </table> <br /> <br /> <br /> <table width="650" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="http://000.com/003.png"></td> </tr> </table> <table width="650" border="0" cellspacing="0" cellpadding="5"> <tr> <td><font color="#a00e15"><p align="left"> お支払い方法 </p></font></td> </tr> </table> <br /> <br /> <br /> <table width="650" border="0" cellspacing="0" cellpadding="0"> <tr> <td><img src="http://000.com/004.png"></td> </tr> </table> <table width="650" border="0" cellspacing="0" cellpadding="5"> <tr> <td><font color="#a00e15"><p align="left"> 注意事項 </p></font></td> </tr> </table></td> </tr> </table> </center>

  • HTMLについて

    HTML初心者です。いろいろ調べながら下記の画像のテンプレートを作っているのですが、1枠と2枠の頭が揃いません。わかる方教えてください。画像が見づらいかもしれませんが宜しくお願い致します。 <html> <body> <br><center> <font size="6" color="#00000"> <b>タイトル</b> </font> <hr> <br><br> <table width="800" height="500" cellpadding="15" cellspacing="10" BORDER="4" bgcolor="F3F30E"> <tr> <td width="50%" rowspan="4" BGCOLOR="F2F276" ALIGN="left" VALIGN="top"> <font color="#00000" size="4"><b><u> 1 </u></b></font> <br><br> <font size="3" color="#00000"> </font> </td> </tr> <tr> <td width="50%" bgcolor="F2F276" ALIGN="left" VALIGN="top"> <font color="#00000" size="4"><b><u> 2 </b></u></font> <br><br> <font size="3" color="#00000"> </font> </td> </tr> <tr> <td width="50%" bgcolor="F2F276" ALIGN="left" VALIGN="top"> <font color="#00000" size="4"><b><u> 3 </b></u></font> <br><br> <font size="3" color="#00000"> </font> </td </tr> <tr> <td width="50%" bgcolor="F2F276" ALIGN="left" VALIGN="top"> <font color="#00000" size="4"><b><u> 4 </b></u></font> <br><br> <font size="3" color="#00000"> <b></b> </font> </td> </tr> </table> </body> </html>

    • ベストアンサー
    • HTML
  • HTMLと文字フォントに関して

    下記の商品ページの下の方にそれぞれ商品説明を記した「Description」などが記載されてあります。 商品ページ1 http://www.ebay.com/itm/Mint-TAMRON-SP-AF-17-50mm-F-2-8-f2-8-XR-LD-ASPH-IF-for-canon-AF-F-S-from-Japan-/221979240719?ssPageName=STRK:MESE:IT 商品ページ2 http://www.ebay.com/itm/Near-Mint-PENTAX-smc-FA-645-400mm-f-5-6-1-5-6-with-Hood-Free-Ship-Japan-241-/141828835849?hash=item2105a84a09:g:sm4AAOSwgQ9Vs04M ■質問 商品ページ1のフォントを、商品ページ2とまったく同じにしたい場合はどのようにすればいいでしょうか?下記に商品ページ1のHTMLを添付させていただきました。どこを修正すればいいかご教示いただけないでしょうか?(質問文字数が限られているので下の方をカットしてあります) <table width="100%" border="0" cellspacing="0" cellpadding="0"><tbody><tr><td> <center> <font color="#ff0000" size="6"><b> <!-- ●●●タイトルを入れる●●● --> </b></font><br><br> <table width="800" cellpadding="10"> <tbody><tr><td bgcolor="#ffffff"> <table width="100%" cellspacing="0" border="0" cellpadding="0"> <tbody><tr><td bgcolor="#ffcc33" valign="top" height="32"> <table width="100%" cellspacing="0" border="0" cellpadding="0"> <tbody><tr><td bgcolor="#ffe566" align="center" height="30" width="25%"> <font color="#000000" size="5"><b> Description </b></font> </td> <td bgcolor="#ffffff" width="75%"></td> </tr> </tbody></table> </td></tr> <tr><td> <table cellspacing="15" width="100%"><tbody><tr><td align="left"> <font color="#000000" size="3"> <!-- ●●●本文を入れる●●● --> <b>■<font size=4><b>Grade:</b></font><br> Mint<br> <br> ■Appearance of the item:<br> Almost no scuffs as pictures.<br> <br> ■Functional:<br> It works properly.<br> <br> ■Optical system:<br> No scratches,<br> No hazes,<br> No fungus,<br> Almost no dusts.<br> <br> ■Including:<br> Front cap,Rear cap,Lens Hood,Original Box.<br> <br> If you have any questions and concern,please do not hesitate to contact me. Thank you for visiting!<br> </b></font> </td></tr></tbody></table> </td></tr> </tbody></table> <table width="100%" cellspacing="0" border="0" cellpadding="0"> <tbody><tr><td bgcolor="#ffcc33" valign="top" height="32"> <table width="100%" cellspacing="0" border="0" cellpadding="0"> <tbody><tr><td bgcolor="#ffe566" align="center" height="30" width="25%"> <font color="#000000" size="5"><b> Payment </b></font> </td> <td bgcolor="#ffffff" width="75%"></td> </tr> </tbody></table> </td></tr> <tr><td> <table cellspacing="15" width="100%"><tbody><tr><td align="left"> <font color="#000000" size="2"><b> <font color="#ff0000">

  • HTMLの質問・・段落のしたかを教えてください。

    ホームページを制作しています。かなりのド素人です。 このカテゴリーじゃない気もしますが。。どうか教えてください。 下記の黄色■の横にあああああが来るようにするには どうすればよいのでしょうか?何か消すのでしょうか? 教えてください。 <table bgcolor="#FFFF00" border="1px" bordercolor="#c0c0c0" cellspacing="1" cellpadding="5" width="10px" height="15px"> <tr><td bgcolor="#FFFF00" align="left" valign="top"></td><tr> </table><font color="#44C600">ああああああ</font><br>

  • Mac IEのバグなのでしょうか?

    TMEspionです。 <table border="0" cellpadding="5" cellspacing="5"><tr><td width="100" align="left" bgcolor="#999999"><table width="50" border="0" cellpadding="5" cellspacing="5"><tr><td align="left" bgcolor="#FFFFFF">左</td></tr><tr><td align="center" bgcolor="#FFFFFF">中</td></tr><tr><td align="right" bgcolor="#FFFFFF">右</td></tr></table></td><td width="100" align="center" bgcolor="#999999"><table width="50" border="0" cellpadding="5" cellspacing="5"><tr><td align="left" bgcolor="#FFFFFF">左</td></tr><tr><td align="center" bgcolor="#FFFFFF">中</td></tr><tr><td align="right" bgcolor="#FFFFFF">右</td></tr></table></td><td width="100" align="right" bgcolor="#999999"><table width="50" border="0" cellpadding="5" cellspacing="5"><tr><td align="left" bgcolor="#FFFFFF">左</td></tr><tr><td align="center" bgcolor="#FFFFFF">中</td></tr><tr><td align="right" bgcolor="#FFFFFF">右</td></tr></table></td></tr><tr><td align="left" bgcolor="#999999">左</td><td align="center" bgcolor="#999999">中</td><td align="right" bgcolor="#999999">右</td></tr></table> --------------------------------- 上記のソースの様に、テーブルを縦2段、横2列にセルを作り、上段はテーブルタグ、下段はテキストでそれぞれalign属性をleft、center,rightと設定しています。 ところがInternet Explorer 5.2 for Macで見ると、 上段右のテーブルタグは「align="right"」の効果が出ていません。 この質問を呼んでいる回答者様には、ブラウザでどう表示されるんでしょうか? どう表示されたかという結果とブラウザ名を教えて下さい。

    • ベストアンサー
    • HTML
  • tableをcssで表記したい

    下記のhtmlのスタイル部分をcssで表記したいのですが、 どのようにすればよいのでしょうか? tableの種類が一つの場合はできるのですが・・・ <table width="100" border="1" cellpadding="1" cellspacing="1" bgcolor="#AAAAAA"> <tr> <td width="30" bgcolor="#FFFFFF">a</td> <td ">b</td> </tr> </table> <br> <table width="50" border="2" cellpadding="2" cellspacing="2" bgcolor="#BBBBBB"> <tr> <td width="25" bgcolor="#CCCCCC">c</td> <td>d</td> </tr> </table>

  • テーブルサイズ指定

    こんにちは。 困ったことがあるのですが、 <TABLE BORDER="1"CELLSPACING=1 CELLPADDING=1 BGCOLOR="#FFFFFF"> <TBODY> <TR> <TD width=170文字</TD> <TD width=638>文字</TD></TR> <TR> <TD>文字</FONT></TD> <TD>文字</TD></TR> </TR></TBODY></TABLE> <BR> <TABLE BORDER="1"CELLSPACING=1 CELLPADDING=1 BGCOLOR="#FFFFFF"> <TBODY> <TR> <TD width=170>文字</FONT></TD> <TD width=638>文字</TD></TR> <TR> <TD>文字</FONT></TD> <TD>文字</TD></TR> </TBODY></TABLE> (それぞれの文字の長さは違います。) という2つのテーブルで、 2つともテーブルの幅が異なるんです。 これを、両方とも同じ幅にすることはできないでしょうか? 宜しくお願いします。

    • ベストアンサー
    • HTML

専門家に質問してみよう