I have been experimenting with using 3 divs to create a table-like layout with 3 columns. I set each div to occupy 33% of the width of the page, and it worked well until I tried to add padding to move the text away from the border. This caused the third div to move to the next line. Any suggestions on how to add padding while keeping all 3 divs in one row would be greatly appreciated.
Code:
CSS:
.container {
padding-top: 53px;
width:100%;
}
.table1{
border-style: solid;
border-width: 2px;
float: left;
width: 33.3%;
text-align: justify;
padding-left: 3px;
padding-right: 3px;
background-color: gray;
}
.table2{
border-style: solid;
border-width: 2px;
border-left: 0px;
border-right: 0px;
float: left;
width: 33.3%;
text-align: justify;
padding-left: 3px;
padding-right: 3px;
}
.table3{
border-style: solid;
border-width: 2px;
float: left;
width: 33.3%;
text-align: justify;
padding-left: 3px;
padding-right: 3px;
}
HTML:
<div class="container">
<div class="table1">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
<div class="table2">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
<div class="table3">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
</div>