こんにちは
下記のコードでdiv要素の最後に文字を埋め込むにはどうすればいいでしょうか?
appendを使ったのですが画像の上に文字が来てしまいます
画像の下に文字を表示したいです。
html
1<!doctype html> 2<html> 3<head> 4 <meta charset="utf-8"> 5 <style> 6 #show1{ background: url('img/img1.png') no-repeat; } 7 #show2{ background: url('img/img2.png') no-repeat; } 8 #show3{ background: url('img/img3.png') no-repeat; } 9 10 11 </style> 12 <title></title> 13 <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> 14</head> 15<body> 16 <div class="box" id="show1">Sample1</div> 17 <div class="box" id="show2">Sample2</div> 18 <div class="box" id="show3">Sample3</div> 19 20<script> 21 $(function(){ 22 $("#show1").append("Sample"); 23 }); 24</script> 25</body> 26 27</html> 28
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。