I am currently immersed in a project utilizing the Twitter Bootstrap 3 framework.
Here is the basic structure of my HTML layout:
- Sidebar
- Main content
The sidebar element has a height set to 100% and a float: left
property so that the div with the class main-content
remains aligned horizontally.
However, upon applying the float left property to the sidebar and adding a row
classed div within the main-content
div, I encountered an unexpected increase in the height of the .row
.
Instead of using float: left
, if I opt for position: fixed
on the sidebar, the height of the .row
adjusts itself based on the content inside it.
Upon inspecting the elements using Chrome's web console, I observed the creation of two pseudo elements on the row - :before
and :after
.
Note that unchecking the CSS properties of these pseudo classes resulted in the .row
height aligning correctly with its child elements.
What causes this issue when I apply float: left
to the sidebar?
How can I resolve this dilemma?
While researching online, I came across this, but unfortunately, it did not offer a solution.
To better illustrate the peculiar behavior of the .row
div excessively extending in height without any content present, I have created a fiddle.
I seek guidance and assistance in clarifying and rectifying this issue. Your help is greatly appreciated.
Thank you in advance.
EDIT : Why does the height of the .row
div become 100% even when its height is undefined?