Help me with column problem 1. how to make two column flexible with web page size ? (if i minimize my web window, one of my column get affected ) 2. how to adjust two column height without applying any height value?

<!DOCTYPE html>
<html>
 <head>
 <style>
header {
    padding: 30px;
    text-align: center;
    background: lightblue;
    font-size: 40px;
}
footer{
    padding: 20px;
    text-align: center;
    background: lightblue;
    font-size: 40px;
    clear: both;  
}
.first-row {
   display: block;
}
.left-column {
    float: left;
    width: 15%;
    background: lightgray;
    height: 264px;
}
.right-column {
    float: right;
    width: 85%;
    background: lightgrey;
}
</style>
    <body>
        <header>Header</header>
        <div class="first-row">
            <div class="left-column">
                <h1>Left column</h1>
            </div>
            <div class=right-column>
                    <p>“On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammeled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.” </p>
                    <p>“On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. In a free hour, when our power of choice is untrammeled and when nothing prevents our being able to do what we like best, every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted. The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure other greater pleasures, or else he endures pains to avoid worse pains.” </p>
            </div>
        </div>    
        <footer>Footer</footer>
    </body>
</html>

!

Here in 1st image my web page is maximize, at that time my sidebar column and text column remains good. I have given extra height to my left side column. when I minimize my web page (2nd image), then my first column mismatch with 2nd column.

how can I fix this?

Please post a Codepen with your code.

I don’t really understand your questions can you be more specific about your desired layout and the problem you have.

In any case, I’d suggest using Flexbox and not floats. It may, in fact, fix both issues (width and height).

1 Like

Honestly, just use flex (or grid, but flex is probably simpler). For changing the width, a media query I guess would fulfil your need. Equal height columns you get out of the box.

If you want to stick with the float hack, you’ll probably want to clearfix, then for equal height columns there are a load of hacks to make them work (note the original date on the article):

@Hemali91 Thank you for editing your post it’s a lot more clear now.

I think the link given is a good resource. If what the pictures show is really the full page layout, then one very simple and maybe a bit naive option you have is to give the body the same background color as the sidebar. That should hide the fact that the sidebar isn’t extending all the way down.

1 Like