Home › Forums › CSS › [Solved] css – width fit to content › Reply To: [Solved] css – width fit to content
March 7, 2015 at 2:59 am
#197514
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>
`