dgrafx
asked on
prevent menu elements from overlapping when window resized
I have a simple design shown here:
<style>
.section {
clear: both;
padding: 0px;
margin: 0px;
}
.col {
display: block;
float:left;
margin: 1% 0 1% 0;
}
.span1 {
width: 16.1%;
}
@media only screen and (max-width: 480px) {
.col { margin: 1% 0 1% 0%;}
.span1 { width: 100%; }
}
</style>
<div class="section group">
<div class="col span1">
ElementOne
</div>
<div class="col span1">
ElementTwo
</div>
<div class="col span1">
LongerElementThree
</div>
<div class="col span1">
ElementFour
</div>
<div class="col span1">
ElementFive
</div>
<div class="col span1">
ElementSix
</div>
</div>
See how the LongerElementThree overlaps before the elements stack?
So I want to know how to prevent this.
Thanks
<style>
.section {
clear: both;
padding: 0px;
margin: 0px;
}
.col {
display: block;
float:left;
margin: 1% 0 1% 0;
}
.span1 {
width: 16.1%;
}
@media only screen and (max-width: 480px) {
.col { margin: 1% 0 1% 0%;}
.span1 { width: 100%; }
}
</style>
<div class="section group">
<div class="col span1">
ElementOne
</div>
<div class="col span1">
ElementTwo
</div>
<div class="col span1">
LongerElementThree
</div>
<div class="col span1">
ElementFour
</div>
<div class="col span1">
ElementFive
</div>
<div class="col span1">
ElementSix
</div>
</div>
See how the LongerElementThree overlaps before the elements stack?
So I want to know how to prevent this.
Thanks
Please provide the screen shot of overlapping as at my end there is no such overlapping.
ASKER
See how the longer element text gets overlapped?
menu-overlap.png
menu-overlap.png
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok right - your jsbin example is what I was trying for ...
thanks for the words - i will look into it!
thanks
thanks for the words - i will look into it!
thanks
Your welcome! Once you get your head wrapped around the basic classes you will kick yourself for not doing this sooner.
I meant to provide the link http://getbootstrap.com/ The key is the grid http://getbootstrap.com/css/#grid where columns are wrapped in a row class then col-xs-1, col-sm-1, col-md-1 or col-lg-1 where the "1" can be any number from 1 to 12 as there are 12 columns. If you want 1 column for the phone, 3 columns for ipad and 6 columns for desktop you would use
I meant to provide the link http://getbootstrap.com/ The key is the grid http://getbootstrap.com/css/#grid where columns are wrapped in a row class then col-xs-1, col-sm-1, col-md-1 or col-lg-1 where the "1" can be any number from 1 to 12 as there are 12 columns. If you want 1 column for the phone, 3 columns for ipad and 6 columns for desktop you would use
<div class="row">
<div class="col-xs-12 col-sm-4 col-md-2"> stuff </div>
<div class="col-xs-12 col-sm-4 col-md-2"> stuff </div>
<div class="col-xs-12 col-sm-4 col-md-2"> stuff </div>
<div class="col-xs-12 col-sm-4 col-md-2"> stuff </div>
<div class="col-xs-12 col-sm-4 col-md-2"> stuff </div>
<div class="col-xs-12 col-sm-4 col-md-2"> stuff </div>
</div>
ASKER
Thanks Scott