javascript - How to make the outer div adaptively adjust its width according to the width of the inner div
PHP中文网
PHP中文网 2017-06-26 10:58:30
0
3
962

It is best to use pure html css, pseudo code example:

<p id="1">
    <p id="2"></p>
    <p id="3">
        <ul></ul>
    </p>
</p>

Let the width of the outer layer p1 change with the width of the inner layer p

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(3)
迷茫

Thanks for the invitation.

<style>
#a {
    border: 1px solid red;
    display: inline-block;
}

#b {
    border: 1px solid green;
    margin: 2px 2px 2px 2px;
    height: 50px;
    width: 500px;
}
</style>
<p id="a">
    <p id="b"></p>
    <p id="c">
        <ul></ul>
    </p>
</p>
Ty80
<style>
 #1 {
  display: inline-block;
 }
</style>
过去多啦不再A梦
#1{
   float:left;
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template