pc版では通常に表示されるtableをレスポンシブのため、縦に並べたいと思っています。
display:block
を使用して縦に配置することはできたのですが、width;100%;
を指定しても長さが中途半端になり、また中央揃えにしようと思ってもうまくいきません。
何が問題でしょうか?
表のレイアウトは|列1|列2|だけの単純なものです。
html
1<div id="date"> 2<table cellspacing="0" cellpadding="0" id="date01" align="center"> 3<tr> 4<td height="41" valign="middle" class="left">内容</td> 5<td valign="middle" class="right">内容</td> 6</tr> 7</table> 8</div>
PC版
css
1#date{ 2width:100%; 3height:42px; 4border:0; 5padding:0; 6margin:10px 23px 0 23px; 7display:block; 8position:relative; 9clear:both; 10 11} 12 13tbody { 14 width: 100%; 15} 16 17#date01{ 18width:100%; 19height:42px; 20border:0; 21padding:0; 22margin:0px; 23display:block; 24position:relative; 25clear:both; 26} 27 28#date01 .left{ 29width: 50%; 30border:0; 31padding:0; 32margin:0; 33color:#ffffff; 34font-weight:bold; 35text-align:center; 36line-height:14px; 37vertical-align:middle; 38background-color:rgb(77, 209, 242); 39} 40 41#date01 .right{ 42border: 1px solid #c0c0c0; 43padding:0; 44margin:0; 45text-align:center; 46line-height:14px; 47vertical-align:middle; 48} 49
SP版
#date{ width:100%; } #date01{ margin-left:auto; margin-right:auto; } #date01 .left{ display:block; line-height: normal; width:100%; } #date01 .right{ display:block; line-height: normal; width:100%; } td{ height:40px; height:30px; }
回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/10/31 11:49