Reputation: 4251
I am having trouble getting two divs side-by-side, using css, and sized like I would like.
I want two divs side-by-side. The div on the left should have a fixed width of 200px. The div on the right should take up the rest of the screen.
Under certain conditions I'll hide the div on the left so the right div should take up the entire screen.
Does anyone know the solution?
Upvotes: 0
Views: 1173
Reputation: 734
This is achievable using CSS alone with the calc function, see this fiddle for example: https://jsfiddle.net/jks421gy/1/
width: calc(100% - 200px);
You need to float the divs, then give the first one the fixed width, then the right one will be 100% of the space minus 200px.
Upvotes: 3
Reputation: 11100
umm have you tried using css classes? Beyond that perhaps twitter bootstrap offers the functionality you need. I also Have heard that masonry is descent and if you want a 1 file solution you can use inline styles.
Upvotes: 1