- 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.
推薦閱讀
- ClickHouse性能之巔:從架構設計解讀性能之謎
- Java Web開發學習手冊
- Oracle Exadata性能優化
- Hands-On Machine Learning with scikit:learn and Scientific Python Toolkits
- 深度學習經典案例解析:基于MATLAB
- SpringMVC+MyBatis快速開發與項目實戰
- Python高級編程
- Instant Typeahead.js
- 人人都懂設計模式:從生活中領悟設計模式(Python實現)
- JavaScript動態網頁開發詳解
- Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)
- Visual Basic程序設計上機實驗教程
- INSTANT Adobe Edge Inspect Starter
- Test-Driven iOS Development with Swift
- 例解Python:Python編程快速入門踐行指南