CSS Columns layout does not work on Firefox - css

I was trying to create a layout with 5 columns,
the height should be stretch by its content,
so i cannot set a fixed height for it,
but it doesn't work in my codepen work
https://codepen.io/yyywork/pen/MWGLJwN
body {
height: 100%;
}
#outer-container {
display: flex;
flex-direction: row;
height: 100%;
}
#inner-container {
flex-grow: 1;
column-count: 5;
height: 100%;
}
.item {
break-inside: avoid;
height: 100%;
}
<div id="outer-container">
<div id="inner-container">
<div class="item item-1">
<b>Col 1</b> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type sp
</div>
<div class="item item-2">
<b>Col 2</b> Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</div>
<div class="item item-3">
<b>Col 3</b> Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</div>
<div class="item item-4">
<b>Col 4</b> Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</div>
<div class="item item-5">
<b>Col 5</b> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type sp
</div>
</div>
</div>

Try to use below CSS its working perfectly on Chrome and Mozilla Firefox.
#inner-container {
display: flex;
flex-direction: row;
align-items: stretch;
}
.item {
flex-basis: calc(100% / 5);
border:1px solid #000;
}
<div id="outer-container">
<div id="inner-container">
<div class="item item-1">
<b>Col 1</b> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type sp
</div>
<div class="item item-2">
<b>Col 2</b> Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</div>
<div class="item item-3">
<b>Col 3</b> Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</div>
<div class="item item-4">
<b>Col 4</b> Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</div>
<div class="item item-5">
<b>Col 5</b> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type sp
</div>
</div>
</div>

Related

How to set display property in flex css

I am trying to change below the CSS to flex but not working. instead of display block and width 100%, I want to do in flex. What is the equal of display block and width 100% in flex?
h1,
h2 {
font-family: Lato;
}
div {
display: flex;
flex-direction: row;
align-items: flex-end;
}
.test1 {
display: flex;
flex-direction: column;
align-items: flex-start;
background-color: #3fd819;
}
.test2 {
background-color: rgb(122, 117, 202);
margin: 5px;
width: 100%;
display: block;
}
.container {
position: relative;
display: inline-block;
flex-direction: column;
}
<div class="container">
<div>
<div class="test1">
<div class="test2">
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the
1500s, when an unknown printer took a galley of type and scrambled it to
make a type specimen book.
</div>
</div>
</div>
</div>
You're over-thinking it. Assuming you can't change the markup, all you need is this:
.test1 {
border: 5px solid #3fd819;
background-color: rgb(122, 117, 202);
}
.test2 {
display: contents;
}
<div class="container">
<div>
<div class="test1">
<div class="test2">
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the
1500s, when an unknown printer took a galley of type and scrambled it to
make a type specimen book.
</div>
</div>
</div>
</div>
If you anticipate having multiple .test2 children of div.test1 and you want them stacked vertically, then that's also simple:
.test1 {
border: 5px solid #3fd819;
background-color: rgb(122, 117, 202);
}
.test2 {
margin: 1em;
}
<div class="container">
<div>
<div class="test1">
<div class="test2">
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the
1500s, when an unknown printer took a galley of type and scrambled it to
make a type specimen book.
</div>
<div class="test2">
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the
1500s, when an unknown printer took a galley of type and scrambled it to
make a type specimen book.
</div>
<div class="test2">
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the
1500s, when an unknown printer took a galley of type and scrambled it to
make a type specimen book.
</div>
</div>
</div>
</div>

Images displayed above the article on mobile devices when using css grid

My issues:
I am creating a webiste with articles and I have to make that site for responsive.
I am using CSS GRID for my site. I have a problem on mobile devices.
I have two types of articles (picture on the left and picture on the right). But when viewed on mobile devices, these two pictures are not under the articles. The image from the first articles should be at the bottom.
#news_content {
padding: 215px 15px 0px 15px;
}
#news_content>.row {
grid-template-columns: repeat(12, 8.533333%);
}
#news_content>.row>.col-1 {
grid-column: span 6;
}
#news_content>.row>.col-1>.col-1-padding {
padding: 20px 0px 0px 30px;
}
#news_content>.row>.col-2 {
grid-column: span 6;
}
#news_content>.row>.col-2>.col-2-padding {
padding: 20px 0px 20px 30px;
}
#media (max-width: 720px) {
#news_content>.row>.col-1,
#news_content>.row>.col-2 {
grid-column: span 12;
}
}
#media (max-width: 720px) {
#news_content {
padding: 50px 45px 0px 15px;
}
}
<div id="news_content" class="grid">
<div class="row">
<div class="col-1">
<div class="col-1-padding">
<img src="https://via.placeholder.com/300x200" id="Image_style">
</div>
</div>
<div class="col-2">
<div class="col-2-padding">
<h1>Lorem Lorem?</h1>
<p class="news">
Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Lorem
Ipsum is simply dummy text of the printing and typesetting industry. Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</p>
</div>
</div>
</div>
</div>
<div id="news_content" class="grid">
<div class="row">
<div class="col-1">
<div class="col-1-padding">
<h1>Lorem Lorem?</h1>
<p class="news">
Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</p>
<p>
Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Lorem
Ipsum is simply dummy text of the printing and typesetting industry. Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</p>
</div>
</div>
<div class="col-2">
<div class="col-2-padding">
<img src="https://via.placeholder.com/300x200" id="Image_style">
</div>
</div>
</div>
</div>
<div id="news_content" class="grid">
<div class="row">
<div class="col-1">
<div class="col-1-padding">
<img src="img/poco.jpg" id="Image_style">
</div>
</div>
<div class="col-2">
<div class="col-2-padding">
<h1>Lorem Lorem?</h1>
<p class="news">
Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</p>
</div>
</div>
</div>
</div>
<div id="news_content" class="grid">
<div class="row">
<div class="col-1">
<div class="col-1-padding">
<h1>Lorem Lorem?</h1>
<p class="news">
Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</p>
<p>
Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</p>
</div>
</div>
<div class="col-2">
<div class="col-2-padding">
<img src="img/video.jpg" id="Image_style">
</div>
</div>
</div>
</div>
#news_content
{
padding: 215px 15px 0px 15px;
}
#news_content > .row
{
grid-template-columns: repeat(12, 8.533333%);
}
#news_content > .row > .col-1
{
grid-column: span 6;
}
#news_content > .row > .col-1 > .col-1-padding
{
padding: 20px 0px 0px 30px;
}
#news_content > .row > .col-2
{
grid-column: span 6;
}
#news_content > .row > .col-2 > .col-2-padding
{
padding: 20px 0px 20px 30px;
}
#media (max-width: 720px)
{
#news_content > .row > .col-1, #news_content > .row > .col-2
{
grid-column: span 12;
}
}
#media (max-width: 720px)
{
#news_content
{
padding: 50px 45px 0px 15px;
}
}

simple flexbox grid overflow fit to row height

I have a very simple grid using flexbox where I want to display multi-line data in a scrollable box. I might be missing a trivial property but the row height doesn't appear to adjust itself properly to the height of it's content.
An example: https://plnkr.co/edit/rCXfvd4Vsh8RgoFja89A?p=preview
.grid {
display: flex;
flex-flow: column;
max-height: 400px;
overflow-y: auto;
}
.grid .header {
font-weight: 700;
margin-bottom: 6px;
border-bottom: 3px solid black;
}
.grid .row {
flex: 1;
display: flex;
flex-flow: row;
}
.grid .row:nth-child(even) {
background: #CCC;
}
.grid .col-1 {
flex: 0 0 60px;
}
.grid .col-2 {
flex: 1 0 200px;
white-space: pre;
}
<h1>Flexbox grid</h1>
<h3>Overflow example</h3>
<div class="grid">
<div class="row header">
<div class="col-1">Col 1</div>
<div class="col-2">Col 2</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">One Line</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">One Line</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
</div>
<h3>No overflow example</h3>
<div class="grid">
<div class="row header">
<div class="col-1">Col 1</div>
<div class="col-2">Col 2</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
</div>
To keep everything simple I my columns are fixed size and all the data I want to display is loaded into the grid (instead of using a virtual grid). Is there a way to fix my example so that the rows adjust itself to the content?
EDIT: SOLVED!
As user #bhv pointed out I should have disabled shrink on .row by applying flex: 1 0 auto instead of flex+:1 (1 auto).
.grid {
display: flex;
flex-flow: column;
max-height: 400px;
overflow-y: auto;
}
.grid .header {
font-weight: 700;
margin-bottom: 6px;
border-bottom: 3px solid black;
}
.grid .row {
flex: 1;
display: flex;
flex-flow: row;
flex-shrink: 0;
}
.grid .row:nth-child(even) {
background: #CCC;
}
.grid .col-1 {
flex: 0 0 60px;
}
.grid .col-2 {
flex: 1 0 200px;
white-space: pre;
}
<h1>Flexbox grid</h1>
<h3>Overflow example</h3>
<div class="grid">
<div class="row header">
<div class="col-1">Col 1</div>
<div class="col-2">Col 2</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">One Line</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">One Line</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
</div>
<h3>No overflow example</h3>
<div class="grid">
<div class="row header">
<div class="col-1">Col 1</div>
<div class="col-2">Col 2</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
<div class="row body">
<div class="col-1">DATA</div>
<div class="col-2">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled</div>
</div>
</div>
https://plnkr.co/edit/jIoaME?p=preview
Since the total height of your items is higher than their parents max-height, and since the flex-shrink defaults to 1, they will shrink as much as possible to fit.
So by simply change flex-shrink to 0 will prevent that.
Also the flex: 1 cause another change of the defaults, where the flex-basis is set to 0, which will make the items share the space left equally, instead of the default auto, which takes their content into account before the remaining space is calculated.
In your case though, where the parent has no height (and flex-direction: column), flex: 1 has no effect and can be deleted.

Divs are overlapping when left column div is greater than right column div

I'm creating multiple 3 column divs on a page. I noticed that if the left column div (data_cell1) is longer than the right column div (data_cell3). The div below goes up into the div above and overlaps it.
What do I need to change in my css to allow there to be separation between each div wrapper?
If the left column div and right column div are the same size, then I don't have this problem.
Here's the code example:
http://jsfiddle.net/huskydawgs/UMf3k/77/
<div class="wrapper-data">
<div class="data_row">
<div class="data_cell1">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
<div class="data_cell2">
</div>
<div class="data_cell3">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s</p>
</div>
</div>
</div>
<div class="wrapper-data">
<div class="data_row">
<div class="data_cell1">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,</p>
</div>
<div class="data_cell2">
</div>
<div class="data_cell3">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.</p>
</div>
</div>
</div>
<div class="wrapper-data">
<div class="data_row">
<div class="data_cell1">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,</p>
</div>
<div class="data_cell2">
</div>
<div class="data_cell3">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.</p>
</div>
</div>
</div>
Since you are using float on some elements you need to clear after to make the parent take the complete height, I use this technique:
.data_row:after {
content:" ";
display:block;
clear:both;
}
You can see more about this here and your demo here
Add overflow: hidden (or anything different than visible) to elements which contain floating elements.
Demo

How can I have un-ordered div with different height floating left?

I would like to have a div which contains 4 columns inside it.
Where as each column will have a div with its contents (Where as some contents are huge and some are lesser).
Instead of me explaining it please have a look at this image:
)
And kindly help me in achieving this layout.
Thank you in advance.
I'm not entirely clear on what your needs are, does the content need to flow over to adjacent columns like the image, or do you have 4 column divs with static content?
Assuming the latter, you could make the column div's behave like table-cells: http://jsfiddle.net/wy4GR/
HTML Code:
<div id="main">
<div class="columns">
<div class="innerDiv">
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</div>
<div class="innerDiv">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s
</div>
</div>
<div class="columns">
<div class="innerDiv">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s
</div>
<div class="innerDiv">
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</div>
</div>
<div class="columns">
<div class="innerDiv">
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</div>
<div class="innerDiv">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s
</div>
</div>
<div class="columns">
<div class="innerDiv">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s
</div>
<div class="innerDiv">
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
</div>
</div>
</div>
CSS Code:
#main {
width: 100%;
height: auto;
}
.columns {
width: 21%;
height: auto;
float:left;
margin: 1%;
}
.innerDiv {
width: auto;
background-color: #ccc;
flot: left;
margin:10px 0 0 0;
}
Working Demo: http://jsfiddle.net/GVLNW/1/
I think you may have idea from this:
.body {
width: 100%;
height: auto;
}
.mainColumn {
width: 840px;
height: auto;
margin: 0px auto;
}
.mainColumn ul {
margin: 0px;
padding: 0px;
}
.mainColumn ul li {
list-style-type: none;
width: 200px;
padding: 0px 0px 0px 10px;
float: left;
}
.colone {
margin: 10px 0px 0px 0px;
background: #CCCCCC;
}
.clear {
clear: both;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<div class="mainColumn">
<ul>
<li>
<div class="colone">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,</p>
</div>
<div class="colone">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
been the industry's standard dummy text ever since the 1500s</p>
</div>
<div class="colone">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, Lorem Ipsum has been the industry's standard dummy text ever since</p>
</div>
</li>
<li>
<div class="colone">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
been the industry's standard dummy text ever since the 1500s, Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>
</div>
<div class="colone">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
been the industry's standard dummy text ever since the 1500s</p>
</div>
<div class="colone">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. </p>
</div>
</li>
<li>
<div class="colone">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy
text ever since the 1500s</p>
</div>
<div class="colone">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
been the industry's standard dummy text ever since the 1500s</p>
</div>
<div class="colone">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, Lorem Ipsum has been the industry's standard dummy text ever since typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, Lorem Ipsum has been the industry's standard dummy text ever since</p>
</div>
</li>
<li>
<div class="colone">
<p>Lorem Ipsum is simply dummy </p>
</div>
<div class="colone">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
been the industry's standard dummy text ever since the 1500s Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, Lorem Ipsum is simply dummy
text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s</p>
</div>
<div class="colone">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, Lorem Ipsum has been the industry's standard dummy text ever since Lorem Ipsum is simply
dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, Lorem Ipsum has been the industry's standard dummy text ever sinceLorem Ipsum is simply dummy text of the printing
and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, Lorem Ipsum has been the industry's standard dummy text ever since</p>
</div>
</li>
</ul>
<div class="clear"></div>
</div>
</body>
</html>

Resources