Reputation:
CSS - How to make side by side not wrap when user make browser size changing? http://jsfiddle.net/QWSHw/
<div class="a">
<div class="gridrow">
<div class="griditem">a
</div>
<div class="griditem">b
</div>
</div>
.a{
background: black;
position: absolute;
top:10px;
width:100%;
}
.gridrow{
background: gray;
width:100%;
}
.griditem{
background: blue;
float:left;
width:300px;
height:300px;
}
Upvotes: 1
Views: 794
Reputation: 9497
Since you're using float: left
, the only thing you can do is set a min-width
rule for the .gridrow
.gridrow{
background: gray;
width:100%;
min-width: 600px;
}
Of course this impose a min screen size of 600px
, if the user resize the browser window to less than 600px
then the horizontal scroll bar will show up.
Upvotes: 3
Reputation: 4301
I'm not sure what exactly you are trying to accomplish, but i can guess you are talking about responsive, or adaptive design.
you need to set your width value in '%' instead of 'px', that will cause the browser to calculate the width on each viewport change and adjust accordingly
i recommend you use a css framework:
Upvotes: 0
Reputation: 2352
Set a min-width:
on your containing Div. This will stop it from decreasing in size to the extent that your content wraps around.
Upvotes: 0