[英]How can i add a background color to a div(that has an id), that is inside a wrapper?
[英]How can I give background color to child div?
在我的HTML頁面中,有左面板和右面板。 右面板中的div(包裝器)中包含一個表單。 包裝器包含在另一個div中。 包裝div的背景為黃色。 但是我想使整個右面板的背景變為黃色。 使用CSS。 我嘗試了最小高度:100%和溢出:自動。 但這行不通。
$(document).ready(function(){ $("button").click(function(){ $("#parent p").css({"background-color": "red"}); }); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <div id="parent"> <p>This is a child.</p> </div> <button>Set BG</button>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.