N
N
Nurshat2015-10-06 15:20:45
css
Nurshat, 2015-10-06 15:20:45

How to stretch div by content?

beaten topic, but still, there is such a code

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
</head>
<body>
<div class="mainContainer">
    <div class="topMenu"></div>
    <div class="container">
        <div class="leftMenu floatLeft">
        </div>
        <div class="information floatLeft">
        </div>
    </div>
</div>
</body>
</html>

html,body{
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica Neue, Helvetica, sans-serif;
}
html{
    min-height: 100%;
    height: 1px;
}
body{
    height: 100%;
}
.mainContainer{
    min-height: 100%;
    height: 1px;
    width: 100%;
}
.topMenu{
    height: 50px;
    width: 100%;
}
.container{
    min-height: 100%;
    height: 1px;
    width: 100%;
}
.leftMenu{
    height: 100%;
    width: 19%;
    padding: 1.5em 1em 1.5em 1em;
    margin-right: -2em;
    overflow-x: hidden;
}
.information{
    position: relative;
    height: 100%;
    width: 81%;
    background-color: #F9F9F9;
    border: 1px solid #bbbbbb;
    border-right-width: 0;
    margin-left: -1px;
}
.floatLeft{
    float: left;
}

before adding the doctype, stretching worked fine, but realizing that I couldn’t do without it, I had to add it and then problems with stretching began, at first I couldn’t stretch the blocks according to the height of the window, the post from habr helped and the styles became like this
html{
    min-height: 100%;
    height: 1px;
}
body{
    height: 100%;
}
I think the principle is clear.
but now a new problem has appeared and the blocks have stopped stretching depending on the content,
my brain is already swimming, I can’t figure out how to do it, please help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Web_Questions, 2015-10-06
@Web_Questions

height:auto; ?)
in more detail, then you need to set this property
height:auto; instead of
height: 1px;
to class
to the .container

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question