S
S
Space2015-10-18 11:17:09
css
Space, 2015-10-18 11:17:09

How to calculate the width of a div?

I make the central block (red) a fixed width of 1024px and center align margin:0 auto;
But how do I add the outer blocks so that they stretch indefinitely, but at the same time the central one is always positioned in the center?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivanq, 2015-10-18
@ruslite

I would put three blocks - left, middle and right. Give them float: left; Middle width: 1024px; Left and right - width: calc(50% - 512px);
PS Example here: jsfiddle.net/Ivanq/hL38md04/1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question