FEM CSS Framework

FEM CSS Framework is a 960px width + 12 column grid system + CSS common styles, to easy and fast develop web layouts.

It is based in the 960 Grid System, but with a twist in the philosophy to make it more flexible and faster to play with boxes.

Cross browser compatible. Tested in IE (6, 7, 8), Opera, Gecko (Firefox) and Webkit (Safari, Chrome) browsers.

Cross Browser

The project is hosted in Github, you can access it here, or download directly using the button below. It contains the different css modules, examples, templates (Photoshop and Fireworks), a printer ready sketch for brainstorming, and other resources.

Download

The grid (grid.css)

Golden Ratio

First thing to say is that is just a 12 column grid, I found 12 columns the simplest and more suitable for most cases.

With more columns I have to start opening the design file to count columns, less the columns start to be too big. Also with 12 columns and using 8 columns for content and 4 columns for sidebar, the dimensions in relation to the with (960px) are close to the Golden Ratio. Not something to worry to much but it's a extra point.

The columns have 10px margin on each side, which makes a 20px gutter. Nice to have some breathe between boxes. But we can get rid of that gutter if we want, as I'll explain later.

In fact, another advantage is that if we remove the gutter in an 8 columns box, we can get a 640px wide box, which is one of the most used video size standards size (see Youtube).

It is a fixed with layout, as 99% of the projects will be fixed sizes, and is easier to design with it. If you need fluid or elastic layout you can check this other two grid systems based on 960: fluid, elastic.

The total width as is becoming standard is 960px. All modern monitors support at least 1024 × 768 pixel resolution. 960 is divisible by 2, 3, 4, 5, 6, 8, 10, 12, 15, 16, 20, 24, 30, 32, 40, 48, 60, 64, 80, 96, 120, 160, 192, 240, 320 and 480. This makes it a highly flexible base number to work with.

In naming conventions I prefer to use - insead of _. This is to keep consistency in my CSS naming, since the CSS properties are hyphenated. The other reason is for SEO. If a selector is an id, it could be used as anchor link, i.e. <a href="#this-is-the-content">go to content</a>, and can be part of the URL, and is better to use hyphens in URLs.

Also I feel a bit strange calling grid-X to the columns, I'd rather call them boxes, so for me the grid is all, and inside we have boxes:

<div class="grid-centered">
<div class="box-8">
...
</div>
<div class="box-4">
...
</div>
</div>

In essence it works the same as 960: box-8 covers the first 8 columns and box-4 the next 4.

With this system we have the possibility to expand the box to avoid the gutter. This is different than removing the margin, this will make the box bigger. Why? to be able to close boxes together for example.

Demo Grid

It can be done in the left, the right or both: box-8-expand-left, box-8-expand-right, box-8-expand. Maybe you ask if it wouldn't be better to name like box-8 expand, and I agree it would, but to maintain IE6 compatibility, which doesn't support nested classes, must be done like this. You can also contract the box, so we can play with box distances and make them same separation as the normal gutter. It's better to see the example to understand.

To avoid the margins, i.e. for nested boxes the classes are no-margin-left and no-margin-right. I prefer to write more but be more semantic, so is easy understandable.

Now if we want to clear for the next floating boxes, I prefer to wrap them in another box instead of adding <div class="clear"></div>. This way they are grouped, and is possible to add styles, backgrounds etc. to the group. This can be done with the box-X-expand:

<div class="grid-centered">
<div class="box-12-expand">
<div class="box-8">
	...
</div>
<div class="box-4">
	...
</div>
</div>
<div class="box-12-expand">
<div class="box-8">
	...
</div>
<div class="box-4">
	...
</div>
</div>
</div>

By utilizing the push-X and pull-X classes, elements can be rearranged, independent of the order in which they appear in the markup. This allows you to keep more pertinent info higher in the HTML, without sacrificing precision in your page layout.

By utilizing the prefix-X and prefix-X classes, we can leave white space before of after the boxes.

I also added the left and right classes just to float elements for example within a box of text.

One last point: if you want to use a border in one of the boxes, it'd break the grid sizes, so the best way to do it is adding a interior div and adding the border to it. I have one class by default that can be used for that purpose, called box. Suitable for styles like borders and backgrounds:

<div class="box-4">
<div class="box">
...
</div>
</div>


The text (text.css)

Demo Text

I like to use relative sizes in text, not only for IE accessibility (it can't resize text based in pixels), but also for easy global resizing. I have a proportions of text, headers etc. and only need to change one line to resize all accordingly. By default it's set to 62.5%, which makes 1em = 10px. I put a size of text elements (p, li, blockquote, etc.) to 1.2em (12px). In case I wanted base font size of 14px, and scale the rest proportionally, I'd have to modify just the base size:

						html {
							font-size: 75%;
						}
					

It maintains the vertical rhythm, so the text of different columns rest under the same horizontal lines. It's very fragile, for instance if you add a pixel border to some element it would unbalance everything, or if you add an image with non proportional height, but in some other cases will work. That is not that important, we can live with that, at least we tried :)

I also added blockquote and pre styles by default. It doesn't harm and in most cases will be enough.

The fonts used are a mix of Mac, Windows, and Linux fonts, to make them as similar as possible in all OS, using the standard style in the rare case your system doesn't have none of them.

Rapid prototyping styles (form.css, table.css, menu.css, grey-box.css)

Demo White Demo Grey Box

I added some general styles to make wireframes fast. Basic styles for forms, tables, menu, and the Grey Box method to background boxes easy. They can be used as start point for our custom designs.

Performance

This framework is pretty light. All CSS modules compressed are about 10kb, and only the grid about 6.5kb. You might want to develop with the individual modules first and then compress all the files in one for optimum performance.

For your convenience I've compressed some combination of modules. You can customise your merged file using a service like this.

Author, Credits and inspiration

FEM CSS Framework is developed by Jesus Carrera, check my front end website, and follow me on twitter.

Nathan Smith, Blueprint CSS Framework, Stephen Bau, Harry Roberts, Jason Santa Maria, Richard Rutter, Wilson Miner, Vladimir Carrer, Tyler Tate, Eric Meyer, and many many other who posted tutorials, articles or books and I learnt from them. Thank you all.

License

Licensed under GPL and MIT. This will allow you to use it in your project no matter what kind.

Testimonials

Thank you for your wonderful framework! I had reviewed several frameworks, and yours seemed to make the most sense. Keep up the awesome work! Brian Andrzejewski, Outreach Team Lead

Awards

FEM CSS Framework Award

9 Responses

  1. November 28, 2011
    A.S web_man

    I used to use 960 gs, but this framework is very interesting … I’ll give it a shot :D

  2. December 16, 2011

    Hello
    Is it possible to enlarge the gri from 960px to 1000px or more? I’m a webmaster in a comamy and I like to enlarge the grid to 1200px, because all the monitors are in 1280x1024px. If it’s possible, how can I do so?

    Regards
    Martin Beurskens

  3. December 16, 2011
    admin

    To do that you would have to fork it, and change all the width values. Let me know how it goes!

  4. December 16, 2011

    Hi
    I’d change all the width values and I have a problem. In the front page every thing is fine. Bit in the admin area I have a box with 2 lines and some graphics in. As long as the width of the box is plain with graphics (5 side by side) everything is ok. But if a line holds only one to 4 graghics, they walk with the coursor of the mouse from the left to the right and back. I don’t know, how to fix the graphics. If you want, sent my an e-mail and I’ll give you access to my website. Here I can’t upload some screenshots.

    Regars
    Martin Beurskens

  5. December 17, 2011
    admin

    I sent you an email

  6. March 9, 2012
    Michel

    Es posible hacerlo responsive como http://www.getskeleton.com ?

  7. March 24, 2012
    Michel

    En la línea 231 debe ser: width: 870px;

  8. April 4, 2012
    admin

    no, por ahora es estático, aunque pienso que el futuro serán frameworks responsive

  9. April 4, 2012
    admin

    Gracias por la corrección, lo he actualizado

Some HTML is OK

Go to top ↑