- Mastering CSS
- Rich Finelli
- 126字
- 2021-07-08 09:45:58
Solving the problems of floats
Okay, so let's look at our problem. You've learned how to change stacked rows into horizontal columns in order to achieve a multicolumn layout, but our containing element around our floated elements has totally collapsed and lost its height because all the elements inside it are floated. As a collapsed element, it doesn't look like it's responding to the margin-bottom property or the background-color we've assigned to it. So, in this section, we'll look at four separate methods to fix this collapse, and we'll try to understand the best way to deal with it. First, we'll use the clear method, followed by the overflow: hidden method, followed by the float method, and then finally the most preferred method: the clearfix hack.
推薦閱讀
- 深度實踐OpenStack:基于Python的OpenStack組件開發(fā)
- Maven Build Customization
- NLTK基礎(chǔ)教程:用NLTK和Python庫構(gòu)建機器學(xué)習(xí)應(yīng)用
- C#程序設(shè)計(慕課版)
- SQL Server 2016數(shù)據(jù)庫應(yīng)用與開發(fā)習(xí)題解答與上機指導(dǎo)
- R Data Analysis Cookbook(Second Edition)
- 青少年信息學(xué)競賽
- Mastering openFrameworks:Creative Coding Demystified
- Creating Data Stories with Tableau Public
- GameMaker Essentials
- 創(chuàng)意UI:Photoshop玩轉(zhuǎn)APP設(shè)計
- RESTful Web Clients:基于超媒體的可復(fù)用客戶端
- 金融商業(yè)數(shù)據(jù)分析:基于Python和SAS
- 零基礎(chǔ)PHP從入門到精通
- Java核心技術(shù)速學(xué)版(第3版)