Professional Clearfix
How do I make an professional clearfix?
Floating elements inside a container makes the container empty. Here are two good methods for correcting this problem. . What is a professional clearfix? How do you make a professional clearfix? This script and codes were developed by David Rodriguez on 24 November 2022, Thursday.
Professional Clearfix - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Professional Clearfix</title> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="wrapper clearfix"> <div class="box">1</div> <div class="box">2</div> <div class="box">3</div> <div class="box">4</div>
</div>
<!-- look at the comments in the css for two methods to fix -->
</body>
</html>
Professional Clearfix - Script Codes CSS Codes
.box{ background:#ddd; width:120px; height:200px; float:left; padding:10px; box-sizing:border-box; text-align:center; margin:5px; font-size:80px;
}
.wrapper{ width:520px; padding:10px; background:#222; margin-left:auto; margin-right:auto; /* overflow:hidden; */
/*
1. Old "clearfix hack", Add overflow:hidden rule to the container div. Hard to explain why works. Its a hack. only problem w/this is if you need content that "overflows" or overlaps the container div.
*/
}
/*
2. Official "clearfix hack",
The code below adds invisible content inside the container to fix the problem. To use, add class="clearfix" to the container.
This is the cleafix hack most professional developers use and it is included in the HTML5 Boilerplate.
*/
.clearfix:before,
.clearfix:after { content: " "; /* 1 */ display: table; /* 2 */
}
.clearfix:after { clear: both;
}
Developer | David Rodriguez |
Username | rodesco |
Uploaded | November 24, 2022 |
Rating | 3 |
Size | 1,940 Kb |
Views | 14,168 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Box-sizing class example | 1,675 Kb |
Responsiveness tester | 1,700 Kb |
Simple Contact Form | 1,905 Kb |
FitText.js Demo | 2,874 Kb |
Triangle Assigment | 1,759 Kb |
Clear Fix Class Example 2 | 2,092 Kb |
Flexible Embedded Media | 1,629 Kb |
Overflow Example | 1,929 Kb |
Dropdown Menu | 1,604 Kb |
Very Simple Responsive Navigation Toggle | 2,517 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Spinners using Font Icons | Keyamoon | 3,007 Kb |
Calculator - codevember 08 - 2016 | Caiocares | 3,260 Kb |
Owl Carousel - jumpTo | OwlFonk | 2,553 Kb |
Drag and Drop Quiz | Cgspicer | 3,837 Kb |
Spiralator 9000 | AdmiralPotato | 4,671 Kb |
Scoreboard.js basic usage | Tbleckert | 1,733 Kb |
Jstam.com Home Page | Jstam | 10,558 Kb |
Mobile first social buttons with no iframe | Alistairtweedie | 3,158 Kb |
Canvas stripes | Adrianparr | 1,948 Kb |
Easing | GreenSock | 2,043 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!