Check out this simplified code snippet for creating three perfectly aligned columns:
* {
box-sizing: border-box;
}
/* Create three equal columns that float next to each other */
.column {
float: left;
width: 33.33%;
padding: 10px;
height: 300px; /* Should be removed. Only for demonstration */
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
</style>
</head>
<body>
<h2>Creating Three Equal Columns</h2>
<div class="row">
<div class="column" style="background-color:#aaa;">
<h2>Column 1</h2>
<p>Some text..Tutorial to learn more about website layouts</p>
</div>
<div class="column" style="background-color:#bbb;">
<h2>Column 2</h2>
<p>Some text..Tutorial to learn more about website layouts Tutorial to learn more about website layouts</p>
</div>
<div class="column" style="background-color:#ccc;">
<h2>Column 3</h2>
<p>Some text..</p>
</div>
</div>
If you encounter distortion when adding images to each column, let's resize them with CSS for a perfect alignment:
* {
box-sizing: border-box;
}
/* Create three equal columns that float next to each other */
.column {
float: left;
width: 33.33%;
padding: 10px;
height: 300px; /* Should be removed. Only for demonstration */
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
</style>
</head>
<body>
<h2>Resizing Icons With CSS</h2>
<div class="row">
<div class="column" style="background-color:#aaa;">
<img src="https://img.icons8.com/p/&2x/person-male.png" style="max-width: 100%">
<h2>Column 1</h2>
<p>Some text..Tutorial to learn more about website layouts</p>
</div>
<div class="column" style="background-color:#bbb;">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS9ZSW2Y6SmhAL8R0yD_9rZjTGvlT79DWkBBULhSg5vVoREb9r5_g&s" style="max-width: 100%">
<h2>Column 2</h2>
<p>Some text..Tutorial to learn more about website layouts Tutorial to learn more about website layouts</p>
</div>
<div class="column" style="background-color:#ccc;">
<img src="https://cdn0.iconfinder.com/data/icons/set-ui-app-android/32/8-512.png" style="max-width: 100%">
<h2>Column 3</h2>
<p>Some text..</p>
</div>
</div>
To ensure that each image fits seamlessly within the layout without distorting the text, we apply CSS rules for resizing the icons.