简体   繁体   中英

How can I give background color to child div?

In my HTML page there is left panel and right panel. In right panel there is a form contained in a div(wrapper). And wrapper is contained in another div. Wrapper div has background yellow. But I want to make background yellow to whole right panel. Using CSS. I tried with min-height:100% and overflow:auto. But it not works.

 $(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> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM