猿问

如何让外层div随内层div的宽度自适应调整宽度

最好是纯html+css,伪代码举例:

<div id="1">

    <div id="2"></div>

    <div id="3">

        <ul></ul>

    </div>

</div>

让外层div1的宽度随内层div的宽度改变

动漫人物
浏览 1513回答 1
1回答

汪汪一只猫

<style>#a {&nbsp; &nbsp; border: 1px solid red;&nbsp; &nbsp; display: inline-block;}#b {&nbsp; &nbsp; border: 1px solid green;&nbsp; &nbsp; margin: 2px 2px 2px 2px;&nbsp; &nbsp; height: 50px;&nbsp; &nbsp; width: 500px;}</style><div id="a">&nbsp; &nbsp; <div id="b"></div>&nbsp; &nbsp; <div id="c">&nbsp; &nbsp; &nbsp; &nbsp; <ul></ul>&nbsp; &nbsp; </div></div>
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答