Skip to content

Instantly share code, notes, and snippets.

@lessallan
Created June 21, 2010 03:34
Show Gist options
  • Save lessallan/446358 to your computer and use it in GitHub Desktop.
Save lessallan/446358 to your computer and use it in GitHub Desktop.
=lesscolumns($width_of_page :960px, $number_of_columns :4, $column_padding :10px, $width_of_gutter :10px, $border_width :0px, $border_style :solid, $border_color :#333)
$number_of_gutters: $number_of_columns - 1
$width_of_column: ($width_of_page - ($width_of_gutter * $number_of_gutters)) / $number_of_columns - ($column_padding * 2) - ($border_width * 2)
width: $width_of_page
+pie-clearfix
> *
width: $width_of_column
margin-left: $width_of_gutter
padding: $column_padding
border: $border_width $border_style $border_color
float: left
&:first-child
margin-left: 0px
#test
+lesscolumns(962px, 4, 10px, 10px, 1px, dotted, #333)
@lessallan
Copy link
Author

I don't like having to set a page width

@lessallan
Copy link
Author

Also my modern browsers are able to handle decimal pixels so we don't have a rounding issue with modern browsers.

@lessallan
Copy link
Author

columns inside of columns isn't great

@lessallan
Copy link
Author

The code needs to some how realize it nested inside of another lesscolumn and feed the column_width of the parent into the page_width of the second set of columns.

@lessallan
Copy link
Author

enumerate a class on the children?

@imathis
Copy link

imathis commented Jun 22, 2010

I don't like having to set a page width

Which would you prefer? Having to set the container width or the width of the columns? You could start the math from either perspective.

@lessallan
Copy link
Author

looks like ie doesn't support :last-child

@guenin
Copy link

guenin commented Jun 30, 2010

IE supports :first-child (mostly)

@lessallan
Copy link
Author

IE8 doesn't

@guenin
Copy link

guenin commented Jun 30, 2010

Sure it does. IE has better :first-child support than :last-child, for whatever reason.

http://www.quirksmode.org/css/contents.html#t17

@lessallan
Copy link
Author

John wins!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment