简体   繁体   中英

To position a div after a fixed div if the fixed div height changes dynamically, css issue

I have a position: fixed div that loads a dynamic image from an external source, the image height changes every time it loads. Now I need to position the next div immediately from where the first div ends.

Have tried by getting the height during runtime but sometimes it takes time to load and the height sent is not proper.

Is there any CSS solution to it.

Theres many ways to do it, the most optimal would be to use floats (float:left;)

 div{ float:left; } .img{ background-color:red; width:100px; height:100px; } .div{ background-color:lime; width:100px; height:100px; } 
 <div class="img">Dynamic Image</div> <div class="div">Div next to it</div> 

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