Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] css – width fit to content Reply To: [Solved] css – width fit to content

#197514
ErwinV
Participant

Allright, below a simple version of the html.
I want to place the red squares in a row, so that the wrapper will be expanded to the right and there will be only one long row and a horizontal scrollbar.
preview: http://jsbin.com/rabosofosu/1/edit?html,css,output

<div class="wrapper">
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
</div>
<style>
.square     {width: 200px; height: 200px; background-color: red; float: left; }
.wrapper    {width: auto; height: 100%; background-color: green;}
</style>

`