Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

my custom grid framework

After getting frustrated with other grid frameworks available for various reasons i decided to just make my own, not only to learn how they work but also so id have my own grid system that im fully fluent in cause i made it.

some info about the grid

the style sheets

After some thought i decided that one of the main things i did not like about bootstrap and many other frameworks was the sheer monstrosity of them, with regards to how they shove all the markup in a single style sheet, whilst this may or may not affect speed it is just a hassle so i decided to break my sheets up into separate sheets for function groups.

they are

grid.css this is the grid and all its attributes like rows and offsets. accesory.css this will cover all the accessories like sliders and fancy forms and nav elements anything that controls the styling of the elements of my website

debug.css OK this one is kinda cool and kinda dumb at the same time. All this does is contain some debugging css classes that help see where things are going wrong, things like a class that will make a element have a border that is dashed red so you can see where the grid blocks are sitting and there widths more clearly a grid enable class that will turn on the grid.png background so you can check if things are lining up with the grid and a class that will make stuff solid colours. its kinda cool to have but its also dumb and i just made it so i can save myself time in the long run when trying to work out problems when ive finished the site i can simply unlink the stylesheet and remove the debug classes from my html and never use it again

style.css just the general user made styles will go here therell be some default styling rules up top for styling common elements but the most part will be written manually

current specs: 1000px wide 12 coloum grid coded fluidly using percentages below 1000 it will fill a screen above it will center out the grid with even spacing either side able to nest grids inside each other easily 11 offset rules to position blocks across the page id of made it 12 like bootstrap but i dont quite see how you could offset 12 spaces on a 12 wide grid

planned specs: a set of classes for making responsive layouts ill either do this inside of style.css or make a seperate responsive.css i havnt decided which yet

a few fancy tid bits inside of accesroy.css liek striped tables and some other things remenicant of bootstrap like the well

maybe and i mean maybe some js bits and bobs havnt decided on this yet cause im aware that if a user has js turned off which is a reasonable thing to asume they would anything major i do in js wont work so id have to weigh that up

what makes this better than bootstrap and 960 and all the others and why should you use it? nothing there all far more superior than mine and i wanted something simple in a analogy i wanted a philips screwdriver not a 500 piece toolkit why should you use it? you shouldn't this was made to work for me not for everyone so chances are its not gonna be how you like it

i do however advise you make your own so you know how its a learning expirance and a verry rewarding one at the code was really easy and the results were amazing

11 Answers

I'd love to see a tutorial on how you made it.

text or video? theres not a hell of alot to it the css alone for it can explain it better than i can

http://pastebin.com/yQnSKHfM

its not all my creation the ideas for the main grid i got from the smells like bakin grid and the row css was inspired by the bootstrap row the grid sizes were created by me using gridulator and a calculator to work it out

codepen is much better than pastebin as it creates a working demo for your html/css/javascript

ahh one second then ill make a code pen with all the fancy layouts that most frameworks like to demonstrate

http://codepen.io/seraphzz/pen/KHomA

there you go

nesting dosent yet work ive realised because i have not got my widths as percentages so yeah thats a thing infact i need to check wether a percentage can be a percentage of a parent that is using a percentage for its width ie

parent div width 50% of the entire viewport child div width 50% of the parent

i think i might take a look into code pen that looks usefull for alot more than just making mockups

ooh i like that i can alow others to edit that makes it verry colaborative

Awesome man!

kyle rees I'd rename debug1 - 4 to what the functionality of each of those classes is for.

not a bad idea actually ill work on it there difinatley usefull cause you can visually see what is normally invisible most the time

a little update after sitting down and working on converting my grid to percentages i now have a fluid grid that also has the nifty function of being able to nest grids so you can have say a 4 colum wide element with its own 12 colum inside of it all be it rescaled for the new width but still nested none the less

one thing to mention that had me sitting there scratching my head for a while though

no matter how desperate in need you are for a pen no matter how urgent the message is dont write notes in side of your css thinking youll remove them later i just spent 20 mins trying to work out why one of my classes wasnt working only to find id written a phone number above it and it was breaking the first class

anyway im now going to move onto some fancier things and get a couple modules in place that are usefull first stop is simplifying down the process of making horizontal nav bars with some premade classes also does anyone have any links to some good jquery based slider gallerys not sure of there actual names but its basically a slide show of pictures you specify

also even though i intend this framework to be for me and me alone would any of you want me to post the source code online for you to either look at and learn the workings of use or extend upon