【发布时间】:2017-12-20 01:17:35
【问题描述】:
我在这里有点问题。我正在尝试设置<div id='coupons'> 的背景颜色,但是当我这样做时,什么都没有发生!请帮我解决这个问题。我留下了大部分 CSS,因为我没有任何冲突的背景颜色标签。
#coupons {
background-color: black;
}
<div id='coupons'>
<a id="coupons" name='coupons'>
<div style="float:left">
<img id='myImg' src="https://preview.ibb.co/jBYUxv/coupon1.png" id="i1" height="300px" width="600px">
<div id="myModal" class="modal">
<span class="close">×
</span>
<img class="modal-content" id="img01">
<div id="caption">
</div>
<script>
// Get the modal
var modal = document.getElementById('myModal');
// Get the image and insert it inside the modal - use its "alt" text as a caption
var img = document.getElementById('myImg');
var modalImg = document.getElementById("img01");
img.onclick = function() {
modal.style.display = "block";
modalImg.src = this.src;
}
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
</script>
</div>
</div>
<div id='pformat'>
<p>COUPONS FOR YOU!
</p>
</div>
</a>
</div>
【问题讨论】:
-
我看到图片后面有黑色背景。
标签: javascript html css background-color