I Got Some Ul Li Height Problems
When inspecting my elements, i noticed my height on the first li is very low. I'm trying to add a background to the whole li after selecting the 'city (2)'. The background fills on
Solution 1:
You need to clear your floats as Eric said. The simplest way to achieve that is by applying overflow: hidden
to the container, so:
.cityByLocation {
overflow: hidden;
}
Solution 2:
I think this will solve your problem.
The problem happens when a floated element is within a container box, that element does not automatically force the container’s height adjust to the floated element. When an element is floated, its parent no longer contains it because the float is removed from the flow.
You can use 2 methods to fix it:
{clear:both} or .clearfix
.clearfix:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
.clearfix {
display: inline-block;
}
html[xmlns].clearfix {
display: block;
}
* html.clearfix {
height: 1%;
}
Solution 3:
You can also fix it by setting overflow: hidden
to li
element. It will clear and auto calculate height.
-- update --
thanks @mickmackusa
Post a Comment for "I Got Some Ul Li Height Problems"