After numerous attempts, I am uncertain if this can be accomplished.
I am trying to create an HTML page with 3 columns, each containing different elements. Despite trying various methods, I am stuck and unsure if this layout can only be achieved using a table.
Is there a way to structure the columns as shown in the sample grid below without altering the HTML code, but only utilizing CSS?
Desired Layout:
----------------------------------------------------
| Column left 1| Column center | Column right |
---------------| |----------------
| Column left 2| |
---------------| |
| Column left 3| |
---------------| |
|-------------------|
Current Output:
----------------------------------------------------
| Column left 1| Column left 2 | Column left 3 |
---------------|-------------------|----------------
-------------------------------------
| Column center | Column right |
| |----------------
| |
| |
| |
| |
|-------------------|
Below is the code for my recent attempt...
* {
box-sizing: border-box;
}
.column {
float: left;
width: 33.33%;
padding: 10px;
height: 200px; /* Should be removed. Only for demonstration */
}
.row:after {
content: "";
display: table;
clear: both;
}
<h2>Three Columns</h2>
<div class="row">
<div>
<div class="column" style="background-color:#aaa;">
<h2>Column 1</h2>
<p>Some text..</p>
</div>
<div class="column" style="background-color:#aaa;">
<h2>Column 1 a</h2>
<p>Some text..</p>
</div>
<div class="column" style="background-color:#bbb;">
<h2>Column 1 b</h2>
<p>Some text..</p>
</div>
</div>
<div class="column" style="background-color:#bbb;height: 650px">
<h2>Column 2</h2>
<p>Some text..</p>
</div>
<div class="column" style="background-color:#ccc;">
<h2>Column 3</h2>
<p>Some text..</p>
</div>
</div>
Any assistance or recommendations would be greatly valued. Thank you in advance.