tableの中の写真の上に文字列を表示したいのですが、文字列が写真からずれてしまいます。写真の中に文字列が入りません。写真の中にうまく入れるには何を付け加えればいいですか?
php
1echo '<tr>'; 2 echo '<th>'; 3 echo '写真'; 4 echo '</th>'; 5 echo '<td class="photo">'; 6 echo "<img src="" width=200 height=100 >"; 7 echo '</td>'; 8 echo '<td class="text">'; 9 echo '美味しいカレー'; 10 echo '</td>'; 11 echo '</tr>';
css
1.photo { 2 width: 100%; 3 margin: 0; 4 padding: 0; 5 position: relative; /* 相対位置指定 */ 6} 7 8} 9.text { 10 width: 100%; 11 font-size: 150%; 12 text-align: center; 13 bottom: 4px; 14 margin: 0; 15 padding: 0; 16 color: #fff; 17 background: rgba(0,0,0,0.4); /* 帯の透明度 */ 18 position: absolute; /* 絶対位置指定 */ 19}
回答1件
あなたの回答
tips
プレビュー