Object Oriented CSS

Posted on May 16, 2009

Okay, there is no such thing as object oriented CSS. But there are advantages in OO programming that we can use in CSS.

1
2
3
4
5
6
7
p {
    margin: 0;
}
 
#content p {
    margin: 1em 0;
}

In this example p would be a class and #content p would be an instance of that class. Let’s say the margin set in p is a method and we got the basic concepts of OOP.

Read more…

Scroll to top

Fork me on GitHub