简体   繁体   English

如何将内部div的宽度和高度设置为外部div?

[英]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? 请看看我的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. 到您的外部div,这会将内部div的宽度和高度设置为外部div。

UPDATE UPDATE

Add this CSS to your outer div. 将此CSS添加到外部div。 ie to #LandingDiv 即到#LandingDiv

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

Then add 然后加

background-color: white;

to inner div. 到内部div ie #LandingContent . #LandingContent

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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