• 締切済み

TABLEで表示する時に、一定の個数で列を増やす

こんにちは、お世話になります。 早速ですが、質問がございます。 下記のようなコードを使用して、商品のデーターを呼び出し tableで表示させているのですが、 商品のデーターを15個表示させる指定をした場合に、 横に15個全てが並んでしまいます。 これを、5個毎に段を増やして、 2段目、3段目と表示させることは可能でしょうか? 何か良い方法がございましたら ご教授をお願いいたします。 それでは、何卒よろしくお願いいたします。 <table> <tr> <? for ($i = 0; $i < intval($xml->CurrentCount); $i++) { ?> <? $item = $xml->Goods[$i] ?> <? $size = calcImageSize($item->width, $item->height) ?> <td><a href="<?=$item->LinkCode?>"><img src="<?=$item->ImageUrl?>" width="100" height="140" alt="<?=mb_convert_encoding($item->GoodsName, "SJIS","UTF-8")?>" /></a><br /><span class="red"><?='¥'.number_format($item->Price)?></span></td> <? } ?> </tr> </table>

  • PHP
  • 回答数2
  • ありがとう数1

みんなの回答

回答No.2

gooの仕様(か、OKWaveの仕様で【回答上でリンクになっている文字列に続けて不可視な文字が含まれる】から取り除いてね。 ソースコードは、ある程度力があれば自力で理解できるはずなので解説はしない。そこまでの勉強は自分でやるべきだと思っている。 ==================Q5420571-1.php(書いたPHPのコード)================= <?php /* .NETでいう、 System.Func<Array<T>,int,bool,T,Array<T>> にして、中にDOMに関するコードをかかないことで、DOMへの依存性を下げた。 */ function distribute($src,$n,$fillflag,$absent){ $dest = array(); while(count($src) > 0){ $temp = array(); for($i = 0;$i < $n; $i++){ array_push($temp,$src[0]); array_splice($src,0,1); if(count($src) == 0){ while(($fillflag == true) && (count($temp) < $n)){ array_push($temp,$absent); } break; } } array_push($dest,$temp); } return $dest; } function init(){ $xhtmlns = "http://www.w3.org/1999/xhtml"; /* 勝手にSimpleXMLと予想。ちゃんとこういうのは書きましょう */ $xml = simplexml_load_file("Q5420571-1.xml"); $num = 5; $items = distribute($xml->xpath("Goods"),$num,true,null); /* 個人的にSimpleXMLは好きじゃないのでDOMでいく。*/ $impl = new DOMImplementation(); /* 貧民的プログラミングの発想をしないように! http://takagi-hiromitsu.jp/diary/20051227.html#p02 */ /* DOCTYPE宣言と一致するとlibxmlはmeta要素を頼みもしないのに勝手に挿入しやがります。*/ $doctype = $impl->createDocumentType( "html", "-//W3C//DTD XHTML 1.0 Strict//EN", "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" ); $doc = $impl->createDocument($xhtmlns,"html",$doctype); $head = $doc->createElementNS($xhtmlns, "head"); $title = $doc->createElementNS($xhtmlns, "title"); $title->appendChild($doc->createTextNode("テスト")); $link = $doc->createElementNS($xhtmlns, "link"); $link->setAttribute("rel" ,"stylesheet"); $link->setAttribute("type" , "text/css"); $link->setAttribute("href","Q5420571-1.css"); $head->appendChild($title); $body = $doc->createElementNS($xhtmlns, "body"); $table = $doc->createElementNS($xhtmlns, "table"); $tbody = $doc->createElementNS($xhtmlns, "tbody"); for ($i = 0;$i < count($items);$i++){ $tr = $doc->createElementNS($xhtmlns, "tr"); /* thが必要な場合は自分でコードを考えてね */ for ($j = 0;$j < $num;$j++){ $td = $doc->createElementNS($xhtmlns, "td"); if (!is_null($items[$i][$j])){ $a = $doc->createElementNS($xhtmlns, "a"); $a->setAttribute("href",(string)($items[$i][$j]->LinkCode)); $td->appendChild($a); $img = $doc->createElementNS($xhtmlns, "img"); $img->setAttribute("src",(string)($items[$i][$j]->ImageUrl)); $img->setAttribute("alt",(string)($items[$i][$j]->GoodsName)); $img->setAttribute("width","100"); $img->setAttribute("height","140"); $td->appendChild($img); /* 俺が嫌いなのでbr要素は使わない */ /* classにredとか入っているの嫌いなので 代わりにpriceを付けた。CSSもこれにあわせてあるので注意 */ $span = $doc->createElementNS($xhtmlns, "span"); $span->setAttribute("class","price"); $span->appendChild($doc->createTextNode(number_format(doubleval((string)($items[$i][$j]->Price))))); $td->appendChild($span); } $tr->appendChild($td); } $tbody->appendChild($tr); } $table->appendChild($tbody); $body->appendChild($table); $doc->documentElement->appendChild($head); $doc->documentElement->appendChild($body); $doc->encoding = "Shift_JIS"; $doc->formatOutput = true; /* 必要に応じてここは変える */ header("Content-Type:application/xhtml+xml"); print($doc->saveXML()); } init(); ?> ============Q5420571-1.xml同じディレクトリにあるXMLファイル=============== <?xml version="1.0" encoding="UTF-8"?> <a> <Goods> <width>16</width> <height>16</height> <GoodsName>Goolge Favicon</GoodsName> <LinkCode>http://www.google.co.jp/</LinkCode> <ImageUrl>http://www.google.co.jp/favicon.ico</ImageUrl> <Price>1500</Price> </Goods> <Goods> <width>242</width> <height>95</height> <GoodsName>OKWave バナー</GoodsName> <LinkCode>http://okwave.jp/</LinkCode> <ImageUrl>http://service.okwave.jp/okwave_com/images/logo_top.gif</ImageUrl> <Price>740</Price> </Goods> <Goods> <width>16</width> <height>16</height> <GoodsName>Goolge Favicon</GoodsName> <LinkCode>http://www.google.co.jp/</LinkCode> <ImageUrl>http://www.google.co.jp/favicon.ico</ImageUrl> <Price>300</Price> </Goods> <Goods> <width>242</width> <height>95</height> <GoodsName>OKWave バナー</GoodsName> <LinkCode>http://okwave.jp/</LinkCode> <ImageUrl>http://service.okwave.jp/okwave_com/images/logo_top.gif</ImageUrl> <Price>4300</Price> </Goods> <Goods> <width>16</width> <height>16</height> <GoodsName>Goolge Favicon</GoodsName> <LinkCode>http://www.google.co.jp/</LinkCode> <ImageUrl>http://www.google.co.jp/favicon.ico</ImageUrl> <Price>650</Price> </Goods> <Goods> <width>242</width> <height>95</height> <GoodsName>OKWave バナー</GoodsName> <LinkCode>http://okwave.jp/</LinkCode> <ImageUrl>http://service.okwave.jp/okwave_com/images/logo_top.gif</ImageUrl> <Price>700</Price> </Goods> <Goods> <width>16</width> <height>16</height> <GoodsName>Goolge Favicon</GoodsName> <LinkCode>http://www.google.co.jp/</LinkCode> <ImageUrl>http://www.google.co.jp/favicon.ico</ImageUrl> <Price>1500</Price> </Goods> <Goods> <width>242</width> <height>95</height> <GoodsName>OKWave バナー</GoodsName> <LinkCode>http://okwave.jp/</LinkCode> <ImageUrl>http://service.okwave.jp/okwave_com/images/logo_top.gif</ImageUrl> <Price>740</Price> </Goods> <Goods> <width>16</width> <height>16</height> <GoodsName>Goolge Favicon</GoodsName> <LinkCode>http://www.google.co.jp/</LinkCode> <ImageUrl>http://www.google.co.jp/favicon.ico</ImageUrl> <Price>300</Price> </Goods> <Goods> <width>242</width> <height>95</height> <GoodsName>OKWave バナー</GoodsName> <LinkCode>http://okwave.jp/</LinkCode> <ImageUrl>http://service.okwave.jp/okwave_com/images/logo_top.gif</ImageUrl> <Price>4300</Price> </Goods> <Goods> <width>16</width> <height>16</height> <GoodsName>Goolge Favicon</GoodsName> <LinkCode>http://www.google.co.jp/</LinkCode> <ImageUrl>http://www.google.co.jp/favicon.ico</ImageUrl> <Price>650</Price> </Goods> <Goods> <width>242</width> <height>95</height> <GoodsName>OKWave バナー</GoodsName> <LinkCode>http://okwave.jp/</LinkCode> <ImageUrl>http://service.okwave.jp/okwave_com/images/logo_top.gif</ImageUrl> <Price>700</Price> </Goods> </a> ===================Q5420571-1.css(同じディレクトリにあるCSSファイル)================= @charset "UTF-8"; @namespace "http://www.w3.org/1999/xhtml"; span.price{ color:red; } ==================出力結果(ソース)===================================== <?xml version="1.0" encoding="Shift_JIS"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" /> <title>テスト</title> <link rel="stylesheet" type="text/css" href="Q5420571-1.css" /> </head> <body> <table> <tbody> <tr> <td> <a href="http://www.google.co.jp/"></a> <img src="http://www.google.co.jp/favicon.ico" alt="Goolge Favicon" width="100" height="140" /> <span class="price">1,500</span> </td> <td> <a href="http://okwave.jp/"></a> <img src="http://service.okwave.jp/okwave_com/images/logo_top.gif" alt="OKWave バナー" width="100" height="140" /> <span class="price">740</span> </td> <td> <a href="http://www.google.co.jp/"></a> <img src="http://www.google.co.jp/favicon.ico" alt="Goolge Favicon" width="100" height="140" /> <span class="price">300</span> </td> <td> <a href="http://okwave.jp/"></a> <img src="http://service.okwave.jp/okwave_com/images/logo_top.gif" alt="OKWave バナー" width="100" height="140" /> <span class="price">4,300</span> </td> <td> <a href="http://www.google.co.jp/"></a> <img src="http://www.google.co.jp/favicon.ico" alt="Goolge Favicon" width="100" height="140" /> <span class="price">650</span> </td> </tr> <tr> <td> <a href="http://okwave.jp/"></a> <img src="http://service.okwave.jp/okwave_com/images/logo_top.gif" alt="OKWave バナー" width="100" height="140" /> <span class="price">700</span> </td> <td> <a href="http://www.google.co.jp/"></a> <img src="http://www.google.co.jp/favicon.ico" alt="Goolge Favicon" width="100" height="140" /> <span class="price">1,500</span> </td> <td> <a href="http://okwave.jp/"></a> <img src="http://service.okwave.jp/okwave_com/images/logo_top.gif" alt="OKWave バナー" width="100" height="140" /> <span class="price">740</span> </td> <td> <a href="http://www.google.co.jp/"></a> <img src="http://www.google.co.jp/favicon.ico" alt="Goolge Favicon" width="100" height="140" /> <span class="price">300</span> </td> <td> <a href="http://okwave.jp/"></a> <img src="http://service.okwave.jp/okwave_com/images/logo_top.gif" alt="OKWave バナー" width="100" height="140" /> <span class="price">4,300</span> </td> </tr> <tr> <td> <a href="http://www.google.co.jp/"></a> <img src="http://www.google.co.jp/favicon.ico" alt="Goolge Favicon" width="100" height="140" /> <span class="price">650</span> </td> <td> <a href="http://okwave.jp/"></a> <img src="http://service.okwave.jp/okwave_com/images/logo_top.gif" alt="OKWave バナー" width="100" height="140" /> <span class="price">700</span> </td> <td></td> <td></td> <td></td> </tr> </tbody> </table> </body> </html>

rentub
質問者

補足

こんにちは。 この度は、大変ご丁寧にありがとうございました! 上記のコードを参考に、 色々試行錯誤してみたのですが、上手くいきませんでした。 ちなみに、現在使用しているプログラムの全体は 下記のようになっております。 ==================index.php================= <? /* * created by interspace * AccessTrade Webサービスサンプル PHP版 * * version 1.0 2006/09/12 * version 1.01 2006/10/23 * version 1.10 2009/03/12 :SimpleXML関数対応 * pager部分をクリックした際に、カテゴリが引き継げなくなるのを修正 */ require_once 'config.inc.php'; define('WS_TYPE', 'searchgoods'); define('BASE_QUERY', '?ws_ver='.WS_VER.'&ws_id='.WS_ID.'&ws_type='.WS_TYPE); if (isset($_REQUEST['search'])) { $resource = ATWS_URL.BASE_QUERY; $resource .= '&row='.$_REQUEST['row']; $resource .= '&page='.$_REQUEST['page']; $resource .= '&category1='.$_REQUEST['category']; $resource .= '&shop='.$_REQUEST['shop']; $resource .= '&sort1='.$_REQUEST['sort1']; $resource .= '&sort2='.$_REQUEST['sort2']; $resource .= '&sort3='.$_REQUEST['sort3']; $resource .= '&search='.urlencode(mb_convert_encoding($_REQUEST['keyword'], XML_ENCODE, ENCODE)); $xml = simplexml_load_file( $resource ); $data = $_REQUEST; } else { $data['row'] = '10'; $data['category'] = ''; } ?> <? if (isset($_REQUEST['search'])) { ?> <? if ($xml->ErrorMsg != '') { ?> <?=$xml->ErrorCode?><?=$xml->ErrorMsg?> <? } elseif (intval($xml->CurrentCount) == 0) { ?> <? } else { ?> <table> <tr> <? for ($i = 0; $i < intval($xml->CurrentCount); $i++) { ?> <? $item = $xml->Goods[$i] ?> <? $size = calcImageSize($item->width, $item->height) ?> <td><a href="http://a.at.ser.tagreco.com/?to=<?=$item->LinkCode?>" rel="nofollow"><img src="<?=$item->ImageUrl?>" width="100" height="140" alt="<?=mb_convert_encoding($item->GoodsName, "SJIS","UTF-8")?>" /></a><br /><span class="red"><?='¥'.number_format($item->Price)?></span></td> <? } ?> </tr> </table> <? } ?> <? } ?> <? //-- functions -- //画像の表示サイズを計算する function calcImageSize($width, $height) { return $array; } ?> -------------ここまで------------ このファイルに、下記のようなパラメーターを追加して 商品のデーターを呼び出しています。 index.php?ws_ver=1&ws_id=91C8DA5665488CFDBF7132938F8956D5198793&ws_type=searchgoods&search=1&row=5&category=600,700,1300&sort1=5&sort2=12&sort3=11&shop=31054& (例) http://www.apacolle.jp/web/index.php?ws_ver=1&ws_id=91C8DA5665488CFDBF7132938F8956D5198793&ws_type=searchgoods&search=1&category=600,700,1300&sort1=5&sort2=12&sort3=11&shop=31054& 下記の表のループというのも見つけましたが、 これを実際にどう追加して良いのか分かりませんでした。 http://www.phppro.jp/qa/1532 大変恐れ入りますが、再度ご教授いただけますと幸いです。 それでは、何卒よろしくお願いいたします。

  • UmJammer
  • ベストアンサー率58% (115/196)
回答No.1

適宜 </tr><tr> を出力するだけですね。

rentub
質問者

補足

こんにちは。 この度はご回答ありがとうございます! >>適宜 </tr><tr> を出力するだけですね。 具体的な方法を教えて頂けないでしょうか? それでは、何卒よろしくお願いいたします。

関連するQ&A

  • cssで商品を並べる時、テーブルを使わないでできる?

    cssとっかかったばかりの初心者ですのでわけのわからない質問ばかりしてしまいますが、よろしくお願いします。 cssを使ったページに商品を並べる場合、テーブルを使ってレイアウトするのが楽と思いますが、テーブルを使わないで2列、3列というようにできますか? 普通にテーブルを使ったら <table> <tr> <td>item1</td> <td>item2</td> <td>item3</td> </tr> <tr> <td><img src="img/01.jpg" width="100" height="100"></td> <td><img src="img/02.jpg" width="100" height="100"></td> <td><img src="img/03.jpg" width="100" height="100"></td> </tr> </table> ですが、テーブルタグをつかわず、cssで列を指定ってできますか? それとも、商品ラインナップの場合はテーブルで入れるのが普通ですか??? いろいろやってみたんですが、わからなくなったので、質問します。 よろしくお願いします。

    • ベストアンサー
    • XML
  • IEではうまく行くのですが他のブラウザでも表示できるように…

    下記のようにしたのですが、IEではうまくゆくのですが、 他のブラウザではできません。 同じようにするにはどのように調整したらよいのか教えてください。 <DIV> <SPAN style="overflow:hidden;width:30px"> <TABLE border="1" width="100%"> <TR bgcolor="silver"><TD>A</TD></TR> </TABLE> </SPAN> <SPAN id="title" style="overflow-y:scroll;overflow-x:hidden;width:150px;"> <TABLE border="1" style="table-layout:fixed;width:150px"> <TR bgcolor="silver"><TD>C</TD><TD>D</TD><TD>E</TD></TR> </TABLE> </SPAN> </DIV> <!--本体部分--> <DIV> <SPAN id="fixedcols" style="overflow:hidden;overflow-x:scroll;width:30px;height:80px;"> <TABLE border="1" style="width:100%" bgcolor="#ffffcc"> <TR><TD>F</TD></TR> <TR><TD>K</TD></TR> <TR><TD>P</TD></TR> <TR><TD>U</TD></TR> </TABLE> </SPAN> <SPAN id="maincols" style="overflow:scroll;width:150px;height:80px" onscroll="fnc_scroll()"> <TABLE border="1" style="table-layout:fixed;width:150px"> <TR><TD>H</TD><TD>I</TD><TD>J</TD></TR> <TR><TD>M</TD><TD>N</TD><TD>O</TD></TR> <TR><TD>R</TD><TD>S</TD><TD>T</TD></TR> <TR><TD>W</TD><TD>X</TD><TD>Y</TD></TR> </TABLE> </SPAN> </DIV> <SCRIPT language="javascript"> <!-- function fnc_scroll(){ document.all.item('fixedcols').scrollTop=document.all.item('maincols').scrollTop; document.all.item('title').scrollLeft=document.all.item('maincols').scrollLeft; } --> </SCRIPT>

  • テーブル内のテーブルの高さを揃えたい。

    CGIの表示部分を改造中です。 下のソースをhtmlファイルにして見てもらったら判ると思うのですが、 <TABLE border="0"> <COL span="4" width="50"> <TR> <TD valign="top"> <TABLE border="0" cellpadding="0" cellspacing="1" bgcolor="#cccccc" height="100%"> <TR> <TD bgcolor="#ffffff">こんな風に</TD> </TR> </TABLE> </TD> <TD valign="top"> <TABLE border="0" cellpadding="0" cellspacing="1" bgcolor="#cccccc" height="100%"> <TR> <TD bgcolor="#ffffff">枠を置いたときに</TD> </TR> </TABLE> </TD> <TD valign="top"> <TABLE border="0" cellpadding="0" cellspacing="1" bgcolor="#cccccc" height="100%"> <TR> <TD bgcolor="#ffffff">100%のサイズ指定しても合わない高さを</TD> </TR> </TABLE> </TD> <TD valign="top"> <TABLE border="0" cellpadding="0" cellspacing="1" bgcolor="#cccccc" height="100%"> <TR> <TD bgcolor="#ffffff">ちゃんと揃えて配置したい</TD> </TR> </TABLE> </TD> </TR> </TABLE> 高さを100%にしても広がりませんでした。 どうにかして高さ(下の位置)を揃えることは出来ないでしょうか?

    • ベストアンサー
    • HTML
  • テーブルについて

    二つスライドが重なったようなテーブルを作りたいんですけど、一応、下記はそのように表示されたのですが、見え方で言うと、スライドの一枚目に文字を入れると、二枚目のスライドの形がずれてしまうのですがどうすればいいでしょう? <TABLE width="636" cellspacing="0"> <TBODY> <TR> <TD bgcolor="#0080ff" colspan="3" rowspan="2"></TD> <TD width="20" height="20"></TD> </TR> <TR> <TD bgcolor="#97cbff" width="20"></TD> </TR> <TR> <TD height="20" width="20"></TD> <TD bgcolor="#97cbff" colspan="2" width="596"></TD> <TD bgcolor="#97cbff" width="20" height="20"></TD> </TR> </TBODY> </TABLE>

    • ベストアンサー
    • HTML
  • tableタグについて

    <table width="700" border="0"> <tr><td width="700">あああああああ</td></tr> <tr><td width="200">いい</td><td width="500">ううううう</td></tr> </table> このタグですと【ああああああ】の部分が2段になります。 多分<td width="200">のためやと思うのですが、 <tr><td width="200">いい</td><td width="500">ううううう</td></tr> の部分を <tr><td width="700"><table width="700"><tr><td width="200">いい</td><td width="500">ううううう</td></tr></table></td></tr> にすると表示されます。 この方法以外にもっと簡単に表示できる方法はないでしょうか お願いします。

    • ベストアンサー
    • HTML
  • テーブル内に画像表示するとき。

    自サイトでレイアウトにテーブルを使っています(邪道って言わないで……)。 で、サイトロゴをセル内に表示させてネスケで確認したところ、 画像が半分テーブルの外にはみ出したようになってしまいました。 ちなみにはみ出した部分は少ししか表示されず、 つまり絵がぱっつんと途中で切れてしまった状態です。 普段はIE派ですが、こちらでは問題なく表示されます。 ネスケは4.7なのですが、まさかそういうバグがあるのでしょうか。 タグ手書きでいつも何かしらミスがあるので、今回も探したのですが、 何故か何が悪いのかわかりません。 以下にソースを載せますので、一緒に考えてくださると嬉しいです。 ======================= <table bgcolor="#ffffff" width="580" height="210">  <tr>   <td width="210" height="210" rowspan="5">   <img src="×××.gif" width="210" height="210" alt="コメント">   </td>   <td width="370" height="7">   <img src="1.gif" width="1" height="1">   </td>  </tr>  <tr>   <td align="right" height="15" class="orange2">   文章文章文章文章   </td>  </tr>  <tr>   <td height="166">   文章文章文章文章   </td>  </tr>  <tr>   <td height="15" align="right">   文章文章文章文章   </td>  </tr>  <tr>   <td height="7">   <img src="1.gif" width="1" height="1">   </td>  </tr> </table> ======================= 問題の画像は4行目の「×××.gif」。 ちなみに1.gifはこれまたレイアウトの強い味方、 1ピクセル四方の透明画像になっております(笑)。 どうぞ宜しくお願いします。

  • テーブルの位置

    最初からテーブルを一番上に持ってくるにはどうしたら良いですか?CSSで設定するのでしょうか? 【】で囲ってある部分を最初から上にしたいのです。入れ子のようにしてテーブルを挿入すると必ず真中になってしまいます。 <table width=\"800\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" height=\"500\"> <tr bgcolor=\"#FFFF00\"> <td valigin=\"top\" valign=\"top\" colspan=\"4\" height=\"64\">  </tr> <tr> <td colspan=\"3\" height=\"2\">  </td> </tr> <tr> 【<td width=\"170\"> <table width=\"170\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\"> <tr> <td> </td> </tr> </table>】 </td> <td width=\"238\" height=\"352\"> </td> <td width=\"197\"> </td> </tr> <tr> <td colspan=\"3\"> </td> </tr> </table>

  • テーブルの大きさを揃えたい

    各ページの大きさ=高さが揃わないのですが原因がわかりません。 1.文字の高さが指定した高さより大きい?(普通の文字の高さは決まっているのでしょうか。) 2.入れ子にしているテーブルで2行の所が指定した高さより大きい? 3.CSSスタイルの背景の高さが関係している? 4.全体の大きさがずれている? 参考にHTML(高さのみ)抜き出しますので教えていただけませんか。 【ページ1】 <table width="700" height="55" border="0"> <tr> <td><img.gif height="40"> welcome homepage(見た目は2行)</td> <td> </td> <td align="right" valign="bottom"> <img.gif" height="20" ></td></tr></table> <table height="15"></table> <table height="430"> <tr><td height="375"><flash.swf height="360"></td></tr> <tr><td height="25"></td></tr> <tr><td height="15"></td></tr></table> 【ページ2】 <table width="700" height="55" border="0"> <tr> <td height="40"> <img.gif height="40"></td> <td height="40"> </td> <td height="40"></td></tr> <tr><meta http-equiv="Content-Style-Type" content="text/css"> <td height="15"> welcome homepage </td> <td height="15"></td> <td align="right" height="15">|HOME|MAP|MAIL|</td></tr></table> <table height="15"></table> <table height="430"> <tr><td> <table height="10"> <tr><td height="15"></td></tr> <tr><td><IFRAME height="380"></IFRAME></td></tr> </table></td></tr> <tr><td height="15"></td></tr></table>

  • テーブルの位置

    最初からテーブルを一番上に持ってくるにはどうしたら良いですか?CSSで設定するのでしょうか? 【】で囲ってある部分を最初から上にしたいのです。入れ子のようにしてテーブルを挿入すると必ず真中になってしまいます。 <table width="800" border="1" cellspacing="0" cellpadding="0" height="500"> <tr bgcolor="#FFFF00"> <td valigin="top" valign="top" colspan="4" height="64">  </tr> <tr> <td colspan="3" height="2">  </td> </tr> <tr> 【<td width="170"> <table width="170" border="1" cellspacing="0" cellpadding="0"> <tr> <td> </td> </tr> </table>】 </td> <td width="238" height="352"> </td> <td width="197"> </td> </tr> <tr> <td colspan="3"> </td> </tr> </table>

    • ベストアンサー
    • HTML
  • tableの中のtableの表示と外側(大きい方)のtableに背景画像を表示させる方法

    非常にわかりにくいタイトルで申し訳ありません。tableの中にtableを入れて、外側(大きい方)のtableだけ背景画像を表示させたいのですがどのようにすればいいのでしょうか?下記ソースまでは作ったのですが、中(小さい方)のtableがなぜか右よりになってしまいます。小さいtableを真ん中にして、そのtableの周りを画像で囲みたいのですがどのようにすればいいのでしょうか?もちろん、下記ソースでなくても全然かまいません。htmlはまだまだ勉強中で詳しい方からすれば非常に見難いソースで申し訳ありませんが、ぜひお力添えいただけたらと思いますのでよろしくお願いします。 ↓ソース <html> <head> <body> <title>タイトル</title> <TABLE background="画像jpg"><TD width="10%" height="10%"><TR></TD><TD height="100%"></TD><TD width="100%" height="100%"><TD width="100%"><TD> <TABLE border width="600" height="100%" bgcolor="white">  <TR>   <TD> 文章 </TD>  </TR> </TABLE> </CENTER> </body> </html>

専門家に質問してみよう