I
I
Igor Lanko2014-01-11 10:42:13
css
Igor Lanko, 2014-01-11 10:42:13

Responsive block positioning with fixed and 100% width

Good afternoon!
This is not the first time I encounter this problem, but, unfortunately, I could not find a decent solution.
Imagine that we have 2 blocks. The left block has 100% width, as it contains text, which means it should be responsive. The right block has a fixed width, because it contains, for example, a picture.
My wrong decision:

.left {
    width: 100%;
    float: left; /*аналогично и с inline-block*/
}

.right {
     width: 300px;
     float: left; /*аналогично и с inline-block*/
}

With all this, the whole design is obliged to be adaptive (up to mobile resolution, of course).
Thank you!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
F
friogenn, 2014-01-11
@zzloy

.left {
    margin-right: 310px;
}
.right {
    width: 300px;
    float: right;
}

But you have to put right before left.
jsfiddle.net/5dDqr
Not sure if this is a good solution.

D
Dmitry Khristoev, 2014-02-07
@Haoss

blog.html.it/layoutgala

M
ModestesGonze, 2014-06-30
@ModestesGonze

I think this solution will be better than with an indent equal to the width of the column.
jsfiddle.net/5dDqr/2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question