Welcome Guest, Not a member yet? Register   Sign In
960 Grid System
#1

[eluser]Subfactor[/eluser]
Not sure if anyone has checked the 960 grid system out. Great CSS framework with an easy to use grid.

Some of the code requires the children of a grid unit to have special open/close classes (alpha/omega)

Would there be an easy way to add the "alpha" and "omega" classes to my query results.

example //

Code:
<div class="parent">
        <div class="grid_2 alpha">
            ...
        </div>
        <div class="grid_3">
            ...
        </div>
        <div class="grid_2 omega">
            ...
        </div>
   </div>
#2

[eluser]Colin Williams[/eluser]
In your loop, just check if you're on the first or last of your result set.

Code:
// $result is your array
for ($i = 0; $i < count($result); $i++)
{
   print '<div class="grid_2'
      . (($i == 0) ? ' alpha' : (($i + 1 == count($result)) ? ' omega' : NULL)
      . '">Other stuff</div>"; // Use $result[$i] to retrieve current item in loop
}

Double-check that though.. might be a bit buggy Smile You could do this in a foreach loop too if you preferred.

Also, I hate CSS "grid frameworks". They operate under a false assumption of what a gridded layout is. And, I think the HTML should be made to best describe the content it marks up, not formed to play well with CSS rules in place.
#3

[eluser]scatterscatter[/eluser]
@Colin Williams

What do you mean by 'false assumption'? I think you should review your definition of what grid-based design is Tongue They eliminate much of the CSS/browser compatibility headache and keep things structured. You can always add comments and descriptive class names to your div blocks if you find that you don't know what you're looking at. Besides that, it's just you and the content.

<3 grids Smile
#4

[eluser]Subfactor[/eluser]
Weird I thought I had replied to this topic already. Thanks for the code. I have been messing around with it, and its doing exactly what I was looking for.

I gotta agree with scatterscatter.. The 960 grid system has a pretty small footprint and leaves all the id tags across the board free to use.




Theme © iAndrew 2016 - Forum software by © MyBB