Last active
April 8, 2019 23:38
-
-
Save lisacatalano/7109314 to your computer and use it in GitHub Desktop.
Float Collapsing Parent Solutions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Option 0: Set height on parent (only works if parent has a fixed height) */ | |
ul { | |
height: 43px; | |
} | |
/* Option 1: Float the parent */ | |
ul { | |
float: left; | |
} | |
/* Option 2: Add overflow property to the parent */ | |
ul { | |
overflow: auto; | |
} | |
/* Option 3: Add empty div at bottom of parent container with a class "clearfix" */ | |
/* Add to HTML: <div class="clearfix"></div> */ | |
.clearfix { | |
clear: both; | |
} | |
/* Option 4: Add a class of .clearfix to parent element */ | |
.clearfix:after { | |
content: ""; | |
display: table; | |
clear: both; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment