html
1<tr> 2 3 <td class="title"> 4 キャリア名<?php echo $career;?> 5 </td> 6 7 <td id="content_sub"> 8 <ul> 9 <?php foreach($phones as $phone):?> 10 11 <li id="<?php echo $phone;?>"> 12 <label> 13 <input type="checkbox" name="<?php echo $career;?>_phones[]" 14 value="<?php echo $phone;?>" /> 15 <?php echo $phone;?> 16 </label> 17 </li> 18 19 <?php endforeach;?> 20 </ul> 21 </td> 22 23 </tr> 24
css
1td#content_sub{ 2 3 padding: 20px 0 20px 20px; 4 width: 1300px; 5 height: 50px; 6 position: relative; 7} 8 9li#iPhone{ 10 position: absolute; 11 bottom: 40px; 12 border:solid 1px red; 13} 14 15li#Android{ 16 position: absolute; 17 left: 140px; 18 top: 20px; 19 20 21} 22 23li#WindowsPhone{ 24 position: absolute; 25 left: 300px; 26 top: 20px; 27} 28 29li#FirefoxPhone{ 30 position: absolute; 31 bottom: 20px; 32 33 34} 35 36li#choromePhone{ 37 position: absolute; 38 left: 140px; 39 bottom: 20px; 40 41} 42 43li#other{ 44 position: absolute; 45 left: 300px; 46 bottom: 20px; 47} 48
■言語
html,css
■目的
<li>にそれぞれposition:absoluteを指定し(親要素の<td id="content_sub">にposition:relativeを指定)それぞれの<li>を動かしたい。 このときHTMLは変えない。■困っている事
なぜか<li>の一番最初のli#iPhoneだけ動いてくれない。
常に<td id="content_sub">の真ん中にいる。
※ソースコードで見ると、li#iphoneが横いっぱいになっています・・
htmlの方はphpで出力しています。id名は下の画像のようにちゃんと合っています。
回答3件
あなたの回答
tips
プレビュー