Home > front end >  After the parent element absolute positioning, how the child elements open width
After the parent element absolute positioning, how the child elements open width

Time:10-03

The parent {
position: absolute;
Top: - 10 px;
Z - index: 2000! important;
Left: 100%;
Background: # FFF! important;
Border - the radius: 0 px 0 5 px;
padding:10px;
Width: auto;
Min - height: 300 px;
Border: # 2 px solid DDD;
}
The children {
display: inline-block;
}
The above code, it is not open, the width of the parent of the solution

CodePudding user response:

Don't quite understand your question, I will give children to define a width will automatically open

CodePudding user response:

Your parent is not set high, wide to use child elements set up a wide high effect on the parent element, however your child element is only one display: inlinblock

CodePudding user response:

Description is not clear, stick all of the code please, left: 100% drop is dry

CodePudding user response:

In actual development, the width of the parent element is made up of the inside of the child elements open, but the absolute positioning child elements, by text structure from the parent element, so it is not open the parent element, not only hold does not open, but also by limiting the width of the parent element, therefore, don't use the positioning of the child element to open the parent element, this theory is wrong!

CodePudding user response:

Can open
 


<meta charset="utf-8"/& gt;
<meta HTTP - equiv="X - UA - Compatible" content="IE=edge, chrome=1"/& gt;
The name of the page & lt;/title> <br/><style type="text/CSS" & gt; <br/>The parent {<br/>position: absolute; <br/>Border - the radius: 0 px 0 5 px; <br/>padding:10px; <br/>Width: auto; <br/>Min - height: 300 px; <br/>Border: # 2 px solid DDD; <br/>} <br/>The children {<br/>display: inline-block; <br/>} <br/></style> <br/></head> <br/><body> <br/><Div & gt; <br/><Div & gt; <br/>1343545685535554755757 <br/></div> <br/></div> <br/><br/></body> <br/></html> <br/></pre><p class="article - content rp"> CodePudding user response: </p>That there is no absolute positioning way, in what way is better, to achieve this effect <br/> </div> <div class="th_page th_page_color"></div> <div class="umCopyright"> <p>Page link:<a href="/frontend/49178.html" target="_blank" style="color:#999">https//www.codepudding.com/frontend/49178.html</a></p> </div> <div class="detail-arr"> <div class="detail-arr-left">Prev:<a href='/frontend/49177.html'>Js file is stolen</a></div> <div class="detail-arr-right">Next:<a href='/frontend/49179.html'>How process browser Settings</a></div> </div> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="hot-tags neitags"> <ul> <li><i class="iconfont icon-x-tags"></i> Tags:  </li> <a href='/e/tags/?tagname=HTML+%28CSS%29' target='_blank'>HTML (CSS)</a> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="xiangguan"> <ul class="msg msghead"> <li class="tbname">Related</li> </ul> <ul> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="flinks"> <ul> <li><i class="iconfont icon-x-tags"></i> Links:  </li> <li class="liflinks"><a target="_blank" href="/" title="CodePudding">CodePudding</a></li> </ul> </div> </div> </div> </div> <div class="footer"> <p><span style="font-size:16px;color:#666;font-weight: bold">About Us:</span>  <a href="https://www.codepudding.com/contact.html">Contact Us</a>      <a href="https://www.codepudding.com/service.html">Terms of Service</a>      <a href="https://www.codepudding.com/privacy.html"> Privacy Policy</a></p> <p class="foot_info">Copyright © 2010-2023,Powered By <a href="/" target="_blank">CodePudding</a> </p> </div> <script type="text/javascript" src="/skin/code/tianhu.js"></script> </body></html>