Dynamic sidebar width depending on the main div

I have the following code

<div id="content">
    <div id="sidebar"></div>
    <div id="main"></div>

and the css

     width: 840px;
     margin: 0 auto;

     float: left;
     width: ?; -> need to fill dhe auto space

the problem is how i can make #sidebar div to fill the space left from the main div? This image shows what i want


you can use

     float: left;
     width: calc(100% - 840px);

Correct version based od Jean-Bernard Pellerin answer

     float: left;
     width: calc((100% - 840px) / 2);

Need Your Help

Button To Reset The View Of JFrame

java swing

I have to write a program that will generate 20 random circles with random radius lengths. If any of these circles intersect with another, the circle must be blue, and if it does not intersect, the...

Adding rows to datatable through javascript

javascript jquery html5 datatables jquery-datatables

I want to add rows to the datatable when the page is displayed using a javascript array.