Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS

SeHyun Choi
SeHyun Choi
3,441 Points

Creating gutter space between columns

Hello I am trying to make 3 column layout but I can't create the gutter space between each column. When I give margin value to .col they all become one column layout. (.col is inside of .secondary-content and each columns are given class name of .first-column col, .second-column col, .third-column col)

.secondary-content {

}

.col { width:33%; float:left; }

2 Answers

Here is your magic:

.col {
  width: 33%;
  float: left;
}

/* Centers your text inside the tables. Unless you want something harder you need to adjust the table padding. (not margin) */
td{
  text-align:center;
}

/* Collapse squeezes all the tables together so you see 1 border line between the tables. */
table{
  border-collapse:collapse;
  padding:10px;
}

/* Add border to all tables except the last table. */
table:not(:last-child) {
  border-right:1px solid #666;
}