{Carrer web log} ←
Foxy - CSS Framework
Wednesday, June 29, 2011 { 6 Comments }
One of the coolest new stuff in CSS3 is the calc function. Calc() is a dream come true for the people who like to mix various units like(px, em, %) with the goal to have more flexible layout system.With calc you can have something like width: calc(280px - 2em + 2%*1px ….)
When I first heard about calc() my first thought was I can finally implement margins on my CSS Framework Malo.
If you have some .class { width:25% } that will make 4 columns grid (25% + 25% +25% + 25%). The problem is that you can't have precision px margins (gutter). So in the past you had nested divs or .something-like-this{width:24%; margin-left:1%}
With calc() that problem is solved now we can have .class{width:calc(25%-10px); margin-left:10px} . And with that we can have the flexibility of the % and the px precision.
Unfortunately calc is only implemented on Firefox 4 or later. Some documentation indicate that works even on IE9 but my test show differently.
To show the power of CSS3 calc I decided to build one simple CSS Framework. Clearly this framework has no piratical value today because only work on Firefox 4 or later. I build it to show how cool calc() is and to indicate how calc() can be used in the future.
The logic behind this framework:
It is one to twelve column framework.
The margin(gutter) is 10px you can change it if you like.
You can put px, em, % in the default container(like 960px or 73% or 50em)
Let's take one part of the Framework:
.d5{ width:calc(100%/5 - 10px); margin-left:10px} Meaning we have 100%/5 = 20% column with 10px margin or you can build 5 columns inside 100%.
.dx5{calc(100% - 100%/5 - 10px); margin-left:10px} is the second part of the d5 meaning you have 100% - 20% = 80% with 10px margin.
Very simple rule to remember .d5 + .dx5 = 100% or .d7 + dx7 = 100%
Here is example of some grid combination (Firefox only).
Demo1
Demo2
And some cats.
Download this project on GitHub
6 Responses to “Foxy - CSS Framework”
- // Matteo Balocco // 6/29/2011
- // // 6/29/2011
- // // 6/29/2011
-
// Vladimir
// 6/29/2011
@Matteo: I didn't try with -ms vendor prefix. I did this Framework mounts back, this and other million framework that are still waiting ... I also did the UniGrid that we talk about with Davide (Folletto).
@klkl: I actually did other framework with the "box" philosophy, but I hadn't time to publish it.
@stopsatgreen: Thanks for the info and the demo, I was wrong, calc() works in IE9 in some cases. -
// Adam Sanderson
// 6/30/2011
The calc property is neat, but have you looked at box-sizing? I wrote up a little article about using box sizing for layout.
It will give you the same general effect, but works on all recent browsers. - // Vladimir // 6/30/2011
<< Home
About Me <<<
Name: Vladimir Carrer
vladocar [at] gmail.com
Location: Verona, Italy
I'm a web designer, developer, teacher, speaker, generally web addicted ...
My projects <<<
- AI Prompt Directory
- Hand Drawn Icons
- Font Design Inspiration
- Font Pairings
- Free SVG Cut File
- Upcoming NFT projects
- Discord Tutorials
- Free Sublimation Designs
- Tech Feed
- MySQL Lite Administrator
- Quark Mini PHP CMS
- Formy - CSS Form Framework
- Emastic - CSS Framework
- Malo - CSS Library
- The Golden Grid
- 1 line CSS Grid Framework
- Two Lines CSS Framework
- Child Selector System - CSS Framework
- Better Web Readability Project
- Azbuka - CSS Typographical Base Rendering Library
- ClipR - bookmarklet for better reading
- CSS3 Action Framework
- CSS Mini Reset
- HTML5 Mini Template
- CSS Mobile Reset
- picoCSS - JavaScript Framework
- HTML Lorem Ipsum Crash Test
- Object Auto Documentation - JavaScript
- o - JS Library for Object Manipulation
- Foxy - CSS Framework
- Tumblr Free Theme - Better Readability Project
- Box - CSS Framework
- SMART CSS GRID
- nanoJS - Minimal JS DOM Library
- Flexy CSS Framework
- Katana is CSS Layout System made with Flexbox
- Micro CSS Reset
- 60 Grid System
- Simple CSS Button
- ramd.js JavaScript library for making web applications.
- Minimal Notes web app build with Vue.js
- Scribble Font for Prototyping & Wireframing
- Flex One - 1 CSS Class System
- Floaty - CSS Float Based Layout System
- Infinity CSS Grid
- CLI Convert websites into readable PDFs
- keywords-extract - CLI tool, extract keywords from any web page.
- screenshoteer - Make website screenshots and mobile emulations from the command line.
- Basic.css - Classless CSS Starter File
§§Previous Posts <<<
- Multiple object extend pattern in JavaScript
- Object Auto Documentation - JavaScript
- HTML Lorem Ipsum Crash Test
- Write modern CSS - use class
- Event Delegation - JavaScript
- Baseline Grid patterns for Photoshop and CSS
- picoCSS - really small JavaScript Framework
- Svetlo - One Line JavaScript Selector Engine
- Child Selector System - CSS Framework
- About Repaint and Reflow in JavaScript
Other Profiles <<<
Content is licensed under a Creative Commons Public Domain License