A
A
AlPaco2018-02-25 19:49:06
css
AlPaco, 2018-02-25 19:49:06

How to arrange two blocks side by side?

Good evening.
I'm building a website and I've run into a problem.
There are two blocks - left and right. The width of the left block is set as a percentage, while the width of the right block is set in pixels.
I want the left block to shrink when the browser shrinks, while the right block stays in place without moving.
Here are the screenshots:
Before compression:
5a92e8dbe1f37897089172.png
After compression:
5a92e8e626b90752402815.png
Here is an example code: https://jsfiddle.net/u6wdzeus/11/
I would be very grateful, I'm suffering for the second day)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DivineDraft, 2018-02-25
@AlPaco

left left
right right

.left {float:left;width:calc(100% - 300px);}
.right {float:right;width:280px;}

+20px is padding.

A
aloky, 2018-02-25
@aloky

isn't it easier to use bootstrap?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question