質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.49%
HTML5

HTML5 (Hyper Text Markup Language、バージョン 5)は、マークアップ言語であるHTMLの第5版です。

Smarty

Smartyは、PHPアプリケーションで使用されるテンプレートエンジンです。

CSS

CSSはXMLやHTMLで表現した色・レイアウト・フォントなどの要素を指示する仕様の1つです。

Q&A

解決済

2回答

2482閲覧

tableのtdを横並びにしたいです。

21120903ryosuke

総合スコア7

HTML5

HTML5 (Hyper Text Markup Language、バージョン 5)は、マークアップ言語であるHTMLの第5版です。

Smarty

Smartyは、PHPアプリケーションで使用されるテンプレートエンジンです。

CSS

CSSはXMLやHTMLで表現した色・レイアウト・フォントなどの要素を指示する仕様の1つです。

0グッド

0クリップ

投稿2021/01/18 09:26

編集2021/01/18 10:44

tableのtdを横並びにしたいです。

西历、月、日を横並びにしたいのですが
記述が間違っているのか、反映されません。
よろしくお願いします。※出生年月日の前後にもtrがありますが
colspan=は3ではなく2であったり1であったりバラバラです。

出生年月日のみ3にしたい状況です。

html

1<tr> 2<th class="cell_t">出生年月日</th> 3<td class="cell_d" colspan="3">西历<input type="text" name="birthday_y" class="frm_num" size="4" maxlength="4" value="<{$birthday_y}>">4<select name="birthday_m" class="frm_str"> 5<option value=""></option> 6<{html_options options=$date_m_options selected=$birthday_m}> 7</select>8 9<select name="birthday_d" class="frm_str"> 10<option value=""></option> 11<{html_options options=$date_d_options selected=$birthday_d}> 12</select> 13 14<span class="note2">(半角英数)</span> 15</td> 16</tr>

css

1/*-------------------------------------- 2 * テーブル 3 *------------------------------------*/ 4/* テーブル枠 */ 5.tbl { 6 background-color:#afaeae; 7} 8/* タイトル部 */ 9.cell_t { 10 color:#fff; 11 background-color:#00a0e9; 12 padding: 3px; 13 white-space:nowrap; 14 text-align: center; 15 font-size: 1.2em; 16} 17/* データ部 */ 18.cell_d { 19 color:#666666; 20 background-color:#ffffff; 21 padding: 3px; 22 text-align: left; 23 font-size: 1.2em; 24} 25

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

dit.

2021/01/19 07:07

tableタグをすべて(<table>~</table>まで)提示することは可能ですか?
21120903ryosuke

2021/01/19 07:18

以下が該当ページです。 <!-- ヘッダをインクルード --> <{include file='header.tpl' titletag='注册会员/修改会员资料'}> <div id="main_area"> <div id="main_cont"> <!-- 会員情報変更時のみ表示 --> <{if $henko_flag}> <div align="right"><a href="<{$mymenu_url}>">回到我的网页</a></div> <{/if}> <!--// 会員情報変更時のみ表示 --> <div class="title">修改会员资料</div> <br> <!-- エラーメッセージ --> <{if count($errmsg) > 0}> <div class="errbox"> <{foreach from=$errmsg item=value}><{$value}><br><{/foreach}> </div> <{/if}> <!--// エラーメッセージ --> <!-- 会員情報変更時のみ表示 --> <{if $henko_flag}> 修改会员項目、请按[修改]鍵。<br> <br> <b>※即使您更改会员信息的地址,订购时的地址也不会更改。请联系客服(请确保输入订单号)。</b><br> <!--// 会員情報変更時のみ表示 --> <{else}> <!-- 会員登録時のみ表示 --> <ul> <li>如果输入用户名和密码,在下次订购时可以省去重复填写客户资料的时间。注册会员<span class="stress">免费</span>。 <li>请倾务必确认[<a href="<{$kiyaku_url}>" target=_blank>使用规则</a>]。 </ul> <{/if}> <!--// 会員登録時のみ表示 --> <br> <form action="<{$toroku_acturl}>" method="post" onsubmit="return confirm('<{if $henko_flag}>修改会员资料?<{else}>注册会员?<{/if}>')"> <{$toroku_hidden}> <span class="note">*</span>栏为必须填。 <table class="tbl" cellspacing="1" width="100%"> <tr> <td class="cell_t" width="20%">姓名<span class="note">*</span></td> <td class="cell_d" width="*"> 姓<input type="text" name="name_sei" class="frm_str" size="14" maxlength="85" value="<{$name_sei}>">&nbsp; 名<input type="text" name="name_mei" class="frm_str" size="14" maxlength="85" value="<{$name_mei}>"><span class="note2"></td> </tr> <tr> <td class="cell_t">邮编号码<span class="note"><!--*--></span><br><span class="note2"><!--(日本必须填)--></span></td> <td class="cell_d"><input type="text" name="zip" class="frm_num" size="10" maxlength="20" value="<{$zip}>"><br><span class="note2">(例:123-4567)</span> </td> </tr> <!-- <tr> <td class="cell_t">省市自治区/国家名<span class="note">*</span></td> <td class="cell_d">日本国外的顾客,请从省市自治区选择[Overseas],选择国家名。<br>省市自治区<select name="ken_id" class="frm_str" onchange="country_autoset(this, this.form.country_id)"> <option value="">选择</option> <{html_options options=$ken_options selected=$ken_id}> </select>&nbsp;国家名<select name="country_id" class="frm_str" onchange="ken_autoset(this, this.form.ken_id)"> <option value="">选择</option> <{html_options options=$country_options selected=$country_id}> </select> </td> </tr>--> <{if $shop_pref_overseas_omit_flag == "1"}> <tr> <td class="cell_t">国家名<span class="note"><!--*--></span></td> <td class="cell_d"> <!--原文--> <!--<tr> <td class="cell_t">国家名<span class="note">*</span></td> <td class="cell_d"> <select name="country_id" class="frm_str"> <option value="">选择</option> <{html_options options=$country_options selected=$country_id}>--> <!--原文--> <!--追加してみた部分--> <input type="hidden" name="ken_id" value="99" id="ken_id"> 中国 <select name="country_id" id="country_id" style="display:none"> <{html_options options=$so_country_options selected="cn"}> <!--追加してみた部分--> </select> </td> </tr> <{else}> <tr> <td class="cell_t">都道府県/国名<span class="note">*</span></td> <td class="cell_d"> 日本国外の方は都道府県から「日本国外」を選び、国名をお選びください。<br> 都道府県<select name="ken_id" class="frm_str" onchange="country_autoset(this, this.form.country_id)"> <option value="">お選びください</option> <{html_options options=$ken_options selected=$ken_id}> </select>&nbsp; 国名<select name="country_id" class="frm_str" onchange="ken_autoset(this, this.form.ken_id)"> <option value="">お選びください</option> <{html_options options=$country_options selected=$country_id}> </select> </td> </tr> <{/if}> <tr> <td class="cell_t">住址(市区街道村委)<span class="note">*</span></td> <td class="cell_d"><input type="text" name="addr" class="frm_str" size="45" maxlength="85" value="<{$addr}>"></td> </tr> <tr> <td class="cell_t">电话号码<span class="note">*</span></td> <td class="cell_d"><input type="text" name="tel" class="frm_num" size="20" maxlength="20" value="<{$tel}>"><br><span class="note2">(例:044-123-4567)</span></td> </tr> <tr> <td class="cell_t">邮件地址<span class="note">*</span></td> <td class="cell_d"> <input type="text" name="email" class="frm_num" size="28" maxlength="100" value="<{$email}>"><span class="note2">(半角英数)</span><br><span class="note2">(例:xxxxx@example.com) </span></td> </tr> <tr> <th class="cell_t">出生年月日</th> <td class="cell_d" colspan="3">西历<input type="text" name="birthday_y" class="frm_num" size="4" maxlength="4" value="<{$birthday_y}>">月 <select name="birthday_m" class="frm_str"> <option value=""></option> <{html_options options=$date_m_options selected=$birthday_m}> </select>日 <select name="birthday_d" class="frm_str"> <option value=""></option> <{html_options options=$date_d_options selected=$birthday_d}> </select> <span class="note2">(半角英数)</span> </td> </tr> <tr> <td class="cell_t">性別</td> <td class="cell_d"> <input type="radio" name="sex" value="1"<{if $sex == 1}> checked<{/if}>>男性&nbsp;&nbsp; <input type="radio" name="sex" value="2"<{if $sex == 2}> checked<{/if}>>女性 </td> </tr> <tr> <td class="cell_t">用户名<span class="note">*</span></td> <td class="cell_d"> <input type="radio" name="loginid_kbn" value="email"<{if $loginid_kbn == 'email'}> checked<{/if}>>以邮件地址为用户名使用。 <hr> <input type="radio" name="loginid_kbn" value="ori"<{if $loginid_kbn == 'ori'}> checked<{/if}>>以邮件地址以外为用户名使用。<br> &nbsp;&nbsp;&nbsp;<input type="text" name="loginid" class="frm_num" size="20" maxlength="50" value="<{$loginid}>"><span class="note2">(4个字符以上,半角英数)</span><br> &nbsp;&nbsp;&nbsp;<span class="note2">*记号是只能填写连划线,下划线。</span><br> &nbsp;&nbsp;&nbsp;<span class="note2">*已被其他顾客注册的用户名不能注册。</span><br> </td> </tr> <tr> <td class="cell_t">密碼<span class="note">*</span></td> <td class="cell_d"><input type="password" name="password" class="frm_num" size="20" maxlength="8" value="<{$password}>"><span class="note2">( 密码请输入6~32个字符,半角英数)</span></td> </tr> </table> <br> <div align="center"><input type="submit" value="<{if $henko_flag}>修改会员资料<{else}>注册会员<{/if}>"></div> </form> </div><!--// main cont --> </div><!--// main area --> <!-- フッタをインクルード --> <{include file='footer.tpl'}>
dit.

2021/01/19 07:37

できればこの欄ではなく質問を編集していただきたかったのですが、とりあえずtable部分の提示ありがとうございます。 見たところcolspanの記述があるのは「出生年月日」の所だけで、「>※出生年月日の前後にもtrがありますが colspan=は3ではなく2であったり1であったりバラバラです。」とのコメントと一致しません。提示のコードは最新のものでしょうか? また、これが最新のものだった場合基本的に2列のtableで作成されていてcolspanで結合をする必要が無いと思います。もう一度ご確認いただけますか?
guest

回答2

0

自己解決

みなさまアドバイスありがとうございました。以下にて希望のレイアウトができました。出生年月日以外の項目でcolspan="3"をつけることで、出生年月日のみ3項目にできました。

html

1<table class="tbl" cellspacing="1" width="100%"> 2<tr> 3<td class="cell_t" width="20%">姓名<span class="note">*</span></td> 4<td class="cell_d" width="*" colspan="3"> 5<input type="text" name="name_sei" class="frm_str" size="14" maxlength="85" value="<{$name_sei}>">&nbsp; 6<input type="text" name="name_mei" class="frm_str" size="14" maxlength="85" value="<{$name_mei}>"><span class="note2"></td> 7</tr> 8 <tr> 9<td class="cell_t">国家名<span class="note"><!--*--></span></td> 10<td class="cell_d" colspan="3"> 11 12<!--追加してみた部分--> 13<input type="hidden" name="ken_id" value="99" id="ken_id"> 14中国 15<select name="country_id" id="country_id" style="display:none"> 16<{html_options options=$so_country_options selected="cn"}> 17<!--追加してみた部分--> 18</select> 19</td> 20</tr> 21 22<tr> 23<th class="cell_t">邮编号码<span class="note"><!--*--></span><br><span class="note2"><!--(日本必须填)--></span></th> 24<td class="cell_d" colspan="3"><input type="text" name="zip" class="frm_num" size="10" maxlength="20" value="<{$zip}>"><br><span class="note2">(例:123-4567)</span> 25</td> 26</tr> 27 28<tr> 29<th class="cell_t">住址(市区街道村委)<span class="note">*</span></th> 30<td class="cell_d" colspan="3"><input type="text" name="addr" class="frm_str" size="45" maxlength="85" value="<{$addr}>"></td> 31</tr> 32<tr> 33<th class="cell_t">电话号码<span class="note">*</span></th> 34<td class="cell_d" colspan="3"><input type="text" name="tel" class="frm_num" size="20" maxlength="20" value="<{$tel}>"><br><span class="note2">(例:044-123-4567)</span></td> 35</tr> 36<tr> 37<th class="cell_t">邮件地址<span class="note">*</span></th> 38<td class="cell_d" colspan="3"> 39<input type="text" name="email" class="frm_num" size="28" maxlength="100" value="<{$email}>"><span class="note2">(半角英数)</span><br><span class="note2">(例:xxxxx@example.com) </span></td> 40</tr> 41 42<tr> 43<th class="cell_t">出生年月日</th> 44<td class="cell_d">西历<input type="text" name="birthday_y" class="frm_num" size="4" maxlength="4" value="<{$birthday_y}>"> 45</td> 46 47<td class="cell_d"> 48<select name="birthday_m" class="frm_str"> 49<option value=""></option> 50<{html_options options=$date_m_options selected=$birthday_m}> 51</select> 52 </td> 53 54 <td class="cell_d"> 5556<select name="birthday_d" class="frm_str"> 57<option value=""></option> 58<{html_options options=$date_d_options selected=$birthday_d}> 59</select> 60 </td> 61 62<span class="note2">(半角英数)</span> 63</td> 64</tr> 65 66<tr> 67<th class="cell_t">性別</th> 68<td class="cell_d" colspan="3"> 69<input type="radio" name="sex" value="1"<{if $sex == 1}> checked<{/if}>>男性&nbsp;&nbsp; 70<input type="radio" name="sex" value="2"<{if $sex == 2}> checked<{/if}>>女性 71</td> 72</tr> 73 74<tr> 75<th class="cell_t">用户名<span class="note">*</span></th> 76<td class="cell_d" colspan="3"> 77<input type="radio" name="loginid_kbn" value="email"<{if $loginid_kbn == 'email'}> checked<{/if}>>以邮件地址为用户名使用。 78<hr> 79<input type="radio" name="loginid_kbn" value="ori"<{if $loginid_kbn == 'ori'}> checked<{/if}>>以邮件地址以外为用户名使用。<br> 80&nbsp;&nbsp;&nbsp;<input type="text" name="loginid" class="frm_num" size="20" maxlength="50" value="<{$loginid}>"><span class="note2">(4个字符以上,半角英数)</span><br> 81&nbsp;&nbsp;&nbsp;<span class="note2">*记号是只能填写连划线,下划线。</span><br> 82&nbsp;&nbsp;&nbsp;<span class="note2">*已被其他顾客注册的用户名不能注册。</span><br> 83</td> 84</tr> 85<tr> 86<th class="cell_t">密碼<span class="note">*</span></th> 87<td class="cell_d" colspan="3"><input type="password" name="password" class="frm_num" size="20" maxlength="8" value="<{$password}>"><span class="note2">( 88密码请输入6~32个字符,半角英数)</span></td> 89</tr> 90</table>

投稿2021/01/19 14:02

21120903ryosuke

総合スコア7

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

dit.

2021/01/20 01:00

出生年月日の入力項目をそれぞれ別のtdにしたいということだったんですね。 <td class="cell_d" colspan="3">西历<input type…の colspan="3"に引きずられてしまいました。 どのように結合すればいいかわからないという時など便利に使えるので参考までに貼っておきます。 https://tabletag.net/ja/ (Table Tag Generator)
21120903ryosuke

2021/01/20 01:17

わかりにくい質問で申し訳ございませんでした、、 また、追加アドバイスありがとうございます!参考とさせて頂きます。
guest

0

画像を添付したいので、一度回答で書き込みさせていただきます。
ご提示のコードをこちらで再現しようとしたところ画像の通りになりました。
これは質問者が実現したいテーブルの形ですか?(背景がありますが気にしないでください)

デザイン再現画像

(ちなみに、サーバサイド言語もあわせて使っていらっしゃるようなので、そこは書き換えました)

コメントで追記いただいたものをこちらで再現しようとしたところ
再現画像
のようになりました。デザインがこれであっているのでしたらCSSとhtmlの問題ではない気がします、、

投稿2021/01/19 06:09

編集2021/01/19 06:33
moromon

総合スコア86

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

21120903ryosuke

2021/01/19 06:16

ご回答ありがとうございます!そうです!ちなみに上の弾には <tr> <td class="cell_t">邮件地址<span class="note">*</span></td> <td class="cell_d"> <input type="text" name="email" class="frm_num" size="28" maxlength="100" value="<{$email}>"><span class="note2">(半角英数)</span><br><span class="note2">(例:xxxxx@example.com) </span></td> </tr> のようにメールアドレスを記述するボックスが1つありますので 1ボックスの下に 3つのボックスで分割したテーブルを組みたい という感じです 説明下手で申し訳ございません、、
moromon

2021/01/19 06:33

回答に追記しましたのでご確認ください。
21120903ryosuke

2021/01/19 06:48

私の方では、以下のように反映されます。 邮件地址* ボックス 出生年月日 西历 ボックス       月 ボックス       日 ボックス 御回答者様の方では 邮件地址* ボックス 出生年月日 西历 ボックス 月 ボックス 日 ボックス のように反映していますが 私と記述の仕方に違いはございますか?
moromon

2021/01/19 06:53

html,cssは質問者のものを本当にそのまま使っているので、記述に間違いはないと思いますよ。 あとはPHPが絡んでくる問題だと思うので、回答側で現象を再現するために、PHPのコードも載せられた方がいいかもしれないです。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.49%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問