简体   繁体   中英

How to set inner div width and height to outer div ?

<div name="outer" style='background-color:red; '>
       <div name="inner"style='background-color:yellow; width:200px'>

       some content 


        </div>
       <div style="clear: both"></div>
      </div>

please take look any one my jsfiddle?

MY LINK

See this fiddle

Add

display: inline-block;

to your outer div, which will set the width and height of inner div to the outer div.

UPDATE

Add this CSS to your outer div. ie to #LandingDiv

display: flex;
align-items: center;
background-color: transparent;

Then add

background-color: white;

to inner div. ie #LandingContent .

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