Grow your CSS skills. Land your dream job.

best method for css columns?

  • # July 17, 2012 at 11:02 pm

    I am making a new layout and I need to make a section for 4 columns with equal padding between them. I have messed with relative and absolute positioning, floating left with margins to make the white space. My problem is that I need no margin on the first and last column and I am finding first-child and last-child to be problems. I also want to optimize this layout for wordpress so I am trying desperately hard not to assign classes to individual columns that way I can make my loop in wordpress and not have to worry about it. What do you think?

    # July 18, 2012 at 3:47 am

    you can simply use ‘nth-of-type’ instead…like this: http://jsfiddle.net/pseud0cool/vXBfN/1/

    # July 18, 2012 at 3:52 am

    Would this not do the trick? http://jsfiddle.net/PNDTm/1/

    First-child is ussualy well-supported (unlike last-child).

    # July 18, 2012 at 5:55 am

    Your answer is BlueprintCSS or Bootstrap by Twitter!

    http://blueprintcss.org/

    http://twitter.github.com/bootstrap/

    # July 18, 2012 at 6:32 am

    960gs can also do this.

    # July 18, 2012 at 9:00 pm

    For the record, it is useless to add on a framework when you only need one or two things aligned a certain way…

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".