div不換行_div同行_div強制不換行


使用Float

<!--已知兩個div的寬度使用[Float]使兩個DIV同行!注:float使用后需要清除;所以多寫一個div-->
    <div style="width: 300px; height: 200px; border: 1px solid #4cff00;">
        <div style="width: 70%; height: 50%; float: left; background-color: red;">我是第一個div</div>
        <div style="width: 30%; height: 50%; float: right; background-color: yellow;">我是第二個div</div>
        <div style="clear: both;"></div>
    </div>

網頁效果:

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM