Design

50 Useful and Free Seamless Pattern Sets


  

Employing seamless patterns are an extraordinary way to give your design some additional depth and personality. Either by delicately highlighting important areas or for producing a background that will elevate your layout design to top notch status.

In this post you will unearth all types of assorted patterns; for example fabrics, arithmetical shapes, fancy, retro, vintage, grunge, swirls, lines, paper… and much more. We are fairly certain that this vast a collection should be able to satisfy any and all of your pattern cravings. Each set in this compilation contains a variety of popular formats such as .ai, .eps, .pat, .png, and .jpg.

The Pattern Sets

Vector Patterns Set 12 Patterns (.ai, .png & .pat)
This set contains six seamless vector patterns in blue and brown colors. The files are available in: .AI, .PNG and .PAT.

Screenshot

Grunge Stripes Patterns (.jpg and .pat)
12 Free High Resolution Grunge Stripes Photoshop Patterns in one set. They range in resolution from 512px x 512px to 512px x 1024px.

Screenshot

Spring Pattern (.ai, .eps and .svg)
Have fun adding this to backgrounds, illustrations, or your next design project that calls out for a bit of decorative flair, available in AI EPS and SVG format.

Screenshot

Floral Vector Pattern (.ai, .png & .pat)
This set contains six floral vector patterns. Since patterns are in vector format you can change their size and adjust the color to suit your needs. The download includes 6 vector patterns, 6 PNG files and 6 Photoshop patterns.

Screenshot

Geometric Vector Pattern Set (.ai, .png & .pat)
This set contains six vector geometric patterns. This set contains .AI file, 6 PNG files and .PAT file which includes 6 Photoshop patterns. The patterns are made in cyan-blue but you can change the color and size according to your needs.

Screenshot

Renaissance Spring (.eps, .png, & .psd)
This set contains 1 Damask Pattern with 3 Color Options, included EPS, and 300dpi PNG, JPEG, PSD files.

Screenshot

Abstract Patterns (.pat .png)
This pack contains 16 abstract patterns that includes PAT file and 16 PNG pattern images.

Screenshot

Paper Flowers Pattern (.ai)
A set of 7 patterns inspired by floral paper-cuts. Created in Illustrator.

Screenshot

Diamonds and Gears Pattern (.svg)
A cool muted colored seamless pattern featuring diamonds and gears. Great for web backgrounds and print materials.

Screenshot

Abstract Patterns (.pat and .png)
This pack contains 20 abstract patterns that includes PAT files with 20 PNG pattern images.

Screenshot

Blue Patterns (.jpg and .pat)
This is a set of some beautiful blue patterns. Includes the pat file for Photoshop as well .jpegs.

Screenshot

Seamless Camouflage Pattern Background Vector (.eps)
This set contains free seamless camouflage vectors and Photoshop pattern backgrounds in 4 colours.

Screenshot

Pattern Kit One (.ai)
This beautiful set contains 6 patterns that are sure to dress up your next project.

Screenshot

Free Christmas Seamless Pattern (.ai, .eps and .jpg)
This set contains a beautiful free Christmas themed seamless pattern.

Screenshot

Seamless Flower Patterns (.eps)
Set of 5 nice vector seamless flower patterns for your spring designs. EPS stock vector clip art.

Screenshot

Horrific Pattern Vectors (.ai)
Horrific Patterns contains 4 Illustrator CS5 patterns with Halloween elements.

Screenshot

Hand-drawn Floral (.eps, .jpg and .pat)
A subtle hand-drawn seamless vector pattern that you can download and use in your own work. The pattern repeats on all sides so you can use it to fill shapes and areas in your designs.

Screenshot

Christmas Frames (.ai)
This set contains some beautiful Christmas frames patterns to help with all of your seasonal needs.

Screenshot

Gray Seamless Pattern Set for Web Designers (.png and .pat)
This set contains 12 elegant seamless pattern sets in shades of gray.

Screenshot

TipClique Patterns (.Pat)
This set contains high quality 500px x 500px seamless patterns. Ready to use with the paint bucket to fill with the pattern, or use them in a style with the pattern overlay, and bevel texture options.

Screenshot

Vector Seamless Christmas backgrounds (.eps)
This set contains 5 cute vector seamless Christmas backgrounds for your greeting cards, covers and other holiday designs. Format: EPS stock vector clip art. Free for download.

Screenshot

NixVex Free Jagged Pattern (.ai)
This set contains beautiful jagged-edged patterns made in Illustrator CS3.

Screenshot

Four Seamless Vector Patterns (.ai)
These free vector patterns are a combination of waves and squares. The file is available in AI vector format.

Screenshot

Vintage Floral (.eps, .png and .pat)
Here’s a beautiful vintage-style seamless vector pattern that you can download and use in your own work. The pattern repeats on all sides and you can use it to fill shapes and areas in your designs.

Screenshot

Vector Pattern Set 02 (.ai, .png and .pat)
This seamless vector pattern set contains six different patterns. The files are available in: .AI, .PNG and .PAT formats.

Screenshot

Zebra Print Vector Pattern (.ai)
This set contains a simple zebra print vector pattern you can use to make your designs a little wilder.

Screenshot

Branches (eps and png)
A high contrast pattern with detailed branches that would be great for layer overlays in your Photsoshop design works. Or use as is for a high impact background. As usual, repeats on all sides so will fill any areas in your designs.

Screenshot

Free Vector Guilloché Patterns (.eps)
This set contains 6 beautiful vector guilloché patterns.

Screenshot

Seamless Floral Backgrounds Vector (.eps)
Set of 5 beautiful vector seamless floral backgrounds with colorful flowers and leaves. Colors: pink, green, lilac (violet, purple) and brown.

Screenshot

Colour Pattern Pack (.pat, .psd and .png)
Each pattern can be changed in colour in the PSD file, and the jpeg files included can be used for website backgrounds. This download includes 8 jpegs, PSD files of patterns and the PAT file.

Screenshot

Free Seamless Vector Pattern (.ai, .png and .pat)
This seamless vector pattern set contains three different patterns in two colors. The available files are: .ai, .png and .pat.

Screenshot

Mandala Madness Vector (.svg)
This set contains beautiful mandala type vector patterns that can help add an interesting bit of flavor to your designs.

Screenshot

Patterns With Flowers Vector Set (.ai and .tiff)
Set of 3 nice vector seamless patterns with some flowers for your summer related designs and backgrounds.

Screenshot

Planes and UFO Pattern (.ai)
It contains seamless patterns filled with planes and ufos in vector and raster formats

Screenshot

Compositions Patterns (.pat)
This set contains some beautiful patterns made from scans of notebook paper and a good ‘ol composition book, the .pat file and 5 .pngs.

Screenshot

Assorted (.Pat)
17 Adobe Photoshop Patterns in one .pat file (most of them are vertically striped). These patterns were made with Photoshop CS.

Screenshot

Baby Pink Pastel Tileable Patterns (.jpg and .pat)
It is a free combo pack of seamlessly tile-able baby pink pastel patterns in .jpg format as well as a corresponding Photoshop pattern (.pat) set.

Screenshot

Photoshop Pattern Pack (.pat, .psd and .png)
Each pattern can be changed in colour and opacity in the PSD file. This download includes 6 pngs, PSD file of patterns and the PAT file for Photoshop.

Screenshot

Indonesian Batik Vector Pattern 04 (.ai, .eps, .svg, .pat)
This wonderful set contains an Indonesian Batik vector pattern. Contained in the zip file are the various formats mentioned above.

Screenshot

Seamless Christmas Backgrounds Vector (.eps)
Set of 5 beautifully designed Christmas backgrounds with gifts, bells and other Christmas decorations for your holiday designs (cards, postcards, posters, covers, etc). Format: EPS stock vector clip art.

Screenshot

Skulls and Hearts PS Patterns (.pat)
This set contains 3 whimsical pink, black and white Photoshop skull patterns that can be used in various ways.

Screenshot

Flower patterns vector 2 (.eps)
Set of 5 beautiful vector flower patterns that are simply perfect for your spring designs.

Screenshot

Vintage Retro Grunge Patterns (.jpg and .pat)
Free combo pack of seamlessly tile-able vintage retro grunge wallpaper patterns in .jpg format as well as a corresponding Photoshop pattern (.pat) set.

Screenshot

Snowflake Patterns (.jpg and .pat)
This is a set of 12 assorted simple snowflake patterns. Included are the pat file for Photoshop as well as 600 x 600 jpegs for those of you who do not have Photoshop.

Screenshot

Seamless Vintage Floral Backgrounds Vector Set (.eps)
Collection of 5 beautiful vintage floral vector backgrounds with ornaments for your designs.

Screenshot

Flower Pattern Pack (.pat and .jpg)
Want to have a funky website background? These flower patterns are great at adding colour and design to any work. This download includes 8 jpgs of the flower patterns and a PAT file for Photoshop.

Screenshot

Feliz Navidad (.eps, .pat and .jpg
This set contains 1 damask pattern with 3 different color options. Includes the EPS, PAT, and 300dpi transparent PNG, JPEG

Screenshot

New Seamless Pattern Background (.jpg)
This seamless pattern background is designed to be used for large posters or at least printed in high resolution. This free pattern is in JPG format.

Screenshot

Micro Patterns (.pat)
The Micro Patterns set contains a staggering 54 Patterns for Photoshop

Screenshot

Gold Free Pattern (.jpg and .pat)
A wonderful set of six Photoshop patterns for any of your artworks, cards or websites that could use some golden accents. There is one Photoshop .pat file and six individual and seamless .jpg files. The patterns are made on PS CS5.

Screenshot

(rb)


40 Fantastic Movie Related Websites


  

The internet is a popular place for movie fans. It’s a place where you can read the latest reviews, watch trailers of upcoming films and argue plotlines with other film buffs. Big movie studios are vastly aware of how important the internet is to marketing their new films, and as a result they spend a lot of money developing interactive websites to help promote new releases.

Today we would like to showcase 40 movie related websites: 20 movie information websites and blogs and 20 official websites from popular movies over the last 10 years. Both sides of this movie website coin are charged with inspiring examples that are sure to please.

20 Movie Blogs, Fan Sites & Award Websites

1. The Internet Movie Database

The largest movie website on the internet was founded in 1990 by self-confessed movie geek Colin Needham. Even though IMDB was sold to Amazon in 1998, Colin is still the Chief Executive of IMDb. More surprisingly, he still runs the company from his home. The site has gone through dozens of design changes over the last 21 years.

The Internet Movie Database

2. Rotten Tomatoes

Launched in 1999, Rotten Tomatoes is a movie review aggregator that works out a rating for each movie by collecting scores from movie critics. The ‘TOMATOMETER’ tells you the percentage of critics that gave a film a positive review. Films with low scores are given green/rotten tomatoes whilst popular films are displayed using red/fresh tomatoes. The website also displays an average rating from Rotten Tomatoes’ users for each film.

Rotten Tomatoes

3. Metacritic

MetaCritic works in a similar way to Rotten Tomatoes by aggregating scores from a number of different sources. Unlike Rotten Tomatoes, MetaCritic also covers games, TV and music. Each film is given a rating out of 100. Just like Rotten Tomatoes, a user rating is also displayed.

A link to each review that was used to calculate the score of a fim, album or game is listed underneath the score. It’s worth noting that some reviewers, that are considered more important, are given more weight when scores are calculated.

Metacritic

4. ComingSoon

A colourful website that links to the latest trailers of upcoming movies. The site also publishes production stills, DVD reviews and the latest movie related news. They haven’t integrated their great design into their popular discussion forums, which is strange as it’s prominently linked from the main navigation menu.

ComingSoon

5. Movie Mistakes

Arguably the best website on the web for finding mistakes from popular films. Visitors can search for mistakes from their favourite movies or browse through popular mistakes or films with the most errors. Many mistakes also have images attached to show exactly what went wrong.

Movie Mistakes

6. Chasing The Frog

A great website that focuses on films that were based on true stories. Each film is compared to what actually happened in real life and pictures of each major actor in the film is shown next to their real life counterparts. It’s a great way of knowing more about the true events that inspired your favourite films.

Google Adsense and Amazon advertisements are discretely integrated throughout the site and related videos for each movies are also linked to each film.

Chasing The Frog

7. The Academy Of Motion Picture Arts And Sciences (Oscars)

The official Oscars page has an elegant design that showcases upcoming events and lists information about the academny and all past Oscar ceremonies.

The Academy Of Motion Picture Arts And Sciences

8. Festival De Cannes

The respected Cannes film festival has a website design that is not a million miles away from it’s North American counterpart, sharing the same colour scheme and basic website structure.

Festival De Cannes

9. The Razzies

The Razzies is for those who want to reward the worst the movie industry has to offer. Their website breaks most modern conventions for developing a website with every link and image on the home page linking to either their forum, an advertisement or an article from another news website. What else should we expect from The Razzies?

The Razzies

10. AllMoviePhoto

One of the largest collections of movie photographs on the web. The site features images from old and upcoming films. Visitors can search by film or by actor.

AllMoviePhoto

11. Horror Movies

A popular Canadian horror movie community that features reviews, news, discussion forums and a large archive of horror films. The site uses a dark colour scheme that fits it’s genre well.

Horror Movies

12. Bad Biology

A dated looking website that highlights biology and science related mistakes from popular films. Don’t let the poor navigation and design put you off as there are a lot of interesting facts to be found on the site. Plus it’s refreshing to browse a movie related website that doesn’t have advertisements everywhere.

Bad Biology

13. Empire

The UK’s most popular film magazine has a fantastic design that makes navigating the site a breeze. Empire features news, reviews, videos, images, interviews, forums and more.

Empire

14. Film School Rejects

Film School Rejects is a great movie blog that features news, reviews and interviews about Hollywood and upcoming films.

Film School Rejects

15. Fast Rewind

If you grew up in the 80s, you’ll love the 80s Fast Rewind. There are listings for close to 600 films released in the 80s. Each film has a review, details of the music used in the film, triva, bloopers, filming locations and a look behind the scenes.

Fast Rewind

16. Screen Rant

What started off as a place for owner Vic Holtreman to rant about dumb things that happened in films has grown to be a great resource for the latest movie news and reviews. The site shares a similar design to its sister website Game Rant.

Screen Rant

17. Kids In Mind

Kids In Mind provides objective information about the content of films so that parents can decide themselves whether a film is suitable for their children or not. A rating between 1 and 10 is given for sex and nudity, violence and gore and profanity; and descriptions of each scene in the film that the parents might have concerns about are provided in detail.

When browsing the film archives you can quickly see the ratings of a film at a glance. Alternatively, you can read the complete analysis if you need more information.

Kids In Mind

18. Hulu Movies

Launched in 2007 as a joint venture between companies such as NBC, Fox, Viacom and Disney; Hulu is an online video service that lets you watch movies in full. It also shows clips, trailers and documentaries.

Hulu Movies

19. The Quentin Tarantino Archives

The unofficial Quentin Tarantino blog that has official status was launched back in 1999. It remains the best place on the web to find out about the latest Tarantino films in progress and is lucky enough to count the man himself as a fan.

The Quentin Tarantino Archives

20. Roger Ebert

You may not always agree with his reviews but there’s no disputing the experience of film critic Rogert Ebert; the first film critic to receive the Pulitzer Prize for Criticism. His personal website features his latest reviews and commentaries.

Roger Ebert

20 Movie Websites

The vast majority of movie studios are using flash to design their websites these days. This allows them to integrate videos of the films trailer into the content and make the website more interactive. Many of these websites showcase a trailer on the home page and encourage the visitor to ‘Enter The Site’. This area usually features more information about the film, cast and crew and details of how visitors can see the film (cinema, Blu-Ray etc).

21. Avatar

A colourful website that lets you learn about the Avatar movie in a number of ways. Through the small navigation menu at the top left hand side of the page you can view images, videos and download screensavers and background images for your computer. There is very little information on the website itself, with the vast majority of links on the page opening up external websites that are dedicated to specific areas of promoting the film.

Avatar

22. Iron Man 2

The Iron Man 2 website has a beautiful interactive futuristic design. Images, videos and clips can all be shown via the navigation menus. The visitor can switch between the Iron Man and War Machine suits to find out more about them.

 Iron Man 2

23. How To Train Your Dragon

A family friendly design that has lots of games and other activities for kids to play. You can find out more about each dragon in the film too.

How To Train Your Dragon

24. Saw

Most websites are designed to promote just one film, however the Saw website promotes all 7 Saw films. When you click on a specific film on the right hand side of the page, a sub menu appears in the centre of the page that allows you to find out more about the film, view DVD features, trailers and more.

Saw

25. Tron

One of the best designed movie websites online today. Packed full of features, games and information and very easy to navigate. Daft Punk music from the film is played whilst you use the site also for that extra bit of immersion into the world of the film.

Tron

26. Donnie Darko

This was one of the first films to use a website to further the plot of a film. Known for it’s complicated plot, the website acts as something of a companion to the story giving you more hints as to what happened in the movie. Some consider it a stroke of genius whilst others find the website even more frustrating than the film. You decide for yourself!

Donnie Darko

27. Ice Age 3 – Dawn Of The Dinosaurs

A fun website that kids are sure to love. It’s easy to navigate and has lots of interactive material such as videos, images and downloads.

Ice Age 3 - Dawn Of The Dinosaurs

28. District 9

When a visitor views the District 9 website they have to choose whether they are human or an alien. You are then shown a map of Johannesburg. If you click on a restricted area you are warned about unauthorised access and you are then redirected to the Sony page which promotes the film. A great website that’s a good example of how you can make a movie website fun and interactive and still promote the film effectively.

District 9

29. Simpsons Movie

An interactive website that allows the visitor to browse around Springfield to find out more about the characters. It has lots of fun games and you can also create your own Simpsons avatar.

Simpsons Movie

30. Transformers – Dark Of The Moon

The home page features links to buy the latest Transformers DVD. The main site plays footage from the film in the background and has a small nav menu that lets you view trailers, images and downloads.

Transformers - Dark Of The Moon

31. Star Trek

As you would expect from a Star Trek website, the website for the latest Star Trek film has a futuristic design. Images, videos and downloads can all be viewed via the great looking nav at the left hand side of the page. You can also see 360 degree panoramic views of the Star Trek set.

Star Trek

32. Predators

A great website that Predator fans are sure to love. When you use the site your regular cursor is replaced by the infamous 3 beam laser sighting that the Predator uses for targeting. As usual, visitors can view trailers and images and download background images for their computer. There’s also a fun Facebook game.

Predators

33. The Social Network

An elegant website design that displays a photo gallery of all the actors and contributors to the film. Clicking on a person allows you to view more information about them. Annoyingly, when you click to enter the main site from the entry page, it loads it up in a brand new browser window.

The Social Network

34. Alice In Wonderland

Another colourful website from Disney that is full of entertaining games, information, images, downloads and more. Go ahead and fall down the rabbit hole…if you dare.

Alice In Wonderland

35. The Hurt Locker

A unique page that allows users to navigate the site using the bombs on the home page image or via the navigation menu at the top of the site.

The Hurt Locker

36. The Last Airbender

Different areas of the site are transitioned beautifully with fire effects as you move around the site. It’s packed full of information, videos, images, games and more.

The Last Airbender

37. Inglourious Basterds

A cool looking website that lets you find out more about the various characters from Tarantino’s re-imagining of the film Inglourious Basterds.

Inglourious Basterds

38. Shrek

Everyones favourite Ogre has a quick loading website that includes games, downloads, news and more. Information about all 4 Shrek films can be found here.

Shrek

39. The Expendables

The Expendables website shows all of the stars of the film in a large image that moves from side to side. The navigation menu has been integrated into this image. All you have to do is click on the skulls to find out more.

The Expendables

40. Inception

One of the biggest films of last year has a stylish design that is easy to use. Most of the interactive features such as the minute mazes and Inception Dream are hosted on external websites though.

Inception

Do you know of a great movie website that wasn’t included here in our list? If so, feel free to share it with other Noupe readers in the comment area :)

(rb)


An Introduction To Object Oriented CSS (OOCSS)





 



 


Have you ever heard the phrase “Content is King”? Being a Web developer, and therefore having a job that’s often linked to content creation, it’s likely you have. It’s a fairly overused but true statement about what draws visitors to a site.

From a Web developer’s perspective, however, some may argue that speed is king. More and more, I’m starting to favour that stance. In recent years many experienced front-end engineers have offered their suggestions on how we can improve the user experience by means of some performance best practices.

Unfortunately, CSS seems to get somewhat overlooked in this area while many developers (for good reason) focus largely on JavaScript performance and other areas.

In this post, I’ll deal with this often overlooked area by introducing you to the concept of object oriented CSS and how it can help improve both the performance and maintainability of your Web pages.

The Principles Of OOCSS

As with any object-based coding method, the purpose of OOCSS is to encourage code reuse and, ultimately, faster and more efficient stylesheets that are easier to add to and maintain.

OOCSS

As described on the OOCSS GitHub repo’s Wiki page, OOCSS is based on two main principles.

Separation of Structure From Skin

Almost every element on a styled Web page has different visual features (i.e. “skins”) that are repeated in different contexts. Think of a website’s branding — the colors, subtle uses of gradients, or visible borders. On the other hand, other generally invisible features (i.e. “structure”) are likewise repeated.

When these different features are abstracted into class-based modules, they become reusable and can be applied to any element and have the same basic result. Let’s compare some before and after code so you can see what I’m talking about.

Before applying OOCSS principles, you might have CSS that looks like this:

#button {
	width: 200px;
	height: 50px;
	padding: 10px;
	border: solid 1px #ccc;
	background: linear-gradient(#ccc, #222);
	box-shadow: rgba(0, 0, 0, .5) 2px 2px 5px;
}

#box {
	width: 400px;
	overflow: hidden;
	border: solid 1px #ccc;
	background: linear-gradient(#ccc, #222);
	box-shadow: rgba(0, 0, 0, .5) 2px 2px 5px;
}

#widget {
	width: 500px;
	min-height: 200px;
	overflow: auto;
	border: solid 1px #ccc;
	background: linear-gradient(#ccc, #222);
	box-shadow: rgba(0, 0, 0, .5) 2px 2px 5px;
}

The three elements above have styles that are unique to each, and they’re applied with the non-reusable ID selector to define the styles. But they also have a number of styles in common. The common styles might exist for branding purposes or consistency of design.

With a little bit of planning and forethought, we can abstract the common styles so the CSS would end up instead like this:

.button {
	width: 200px;
	height: 50px;
}

.box {
	width: 400px;
	overflow: hidden;
}

.widget {
	width: 500px;
	min-height: 200px;
	overflow: auto;
}

.skin {
	border: solid 1px #ccc;
	background: linear-gradient(#ccc, #222);
	box-shadow: rgba(0, 0, 0, .5) 2px 2px 5px;
}

Now all the elements are using classes, the common styles are combined into a reusable “skin” and nothing is unnecessarily repeated. We just need to apply the “skin” class to all the elements and the result will be the same as what the first example would produce, except with less code and a possiblity for further reuse.

Separation of Containers and Content

The second principle described on the OOCSS GitHub wiki page is the separation of containers from their content. To illustrate why this is important, take the following CSS:

#sidebar h3 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: .8em;
	line-height: 1;
	color: #777;
	text-shadow: rgba(0, 0, 0, .3) 3px 3px 6px;
}

These styles will apply to any third-level headings that are children of the #sidebar element. But what if we want to apply the exact same styles to third-level headings that appear in the footer, with the exception of a different font size and a modified text shadow?

Then we would need to do something like this:

#sidebar h3, #footer h3 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 2em;
	line-height: 1;
	color: #777;
	text-shadow: rgba(0, 0, 0, .3) 3px 3px 6px;
}

#footer h3 {
	font-size: 1.5em;
	text-shadow: rgba(0, 0, 0, .3) 2px 2px 4px;
}

Or we might end up with something worse:

#sidebar h3 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 2em;
	line-height: 1;
	color: #777;
	text-shadow: rgba(0, 0, 0, .3) 3px 3px 6px;
}

/* other styles here.... */

#footer h3 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 1.5em;
	line-height: 1;
	color: #777;
	text-shadow: rgba(0, 0, 0, .3) 2px 2px 4px;
}

Now we’re unnecessarily duplicating styles, and might not realize it (or simply don’t care). With OOCSS, we’re encouraged to give more forethought to what is common among different elements, then separate those common features into modules, or objects, that can be reused anywhere.

The styles that are declared using the descendant selector in those above examples are not reusable, because they are dependent on a particular container (in this case either the sidebar or the footer).

When we use OOCSS’s class-based module building, we ensure that our styles are not dependent on any containing element. This means they can then be reused anywhere in the document, regardless of structural context.

A Real-World Example

To further illustrate how OOCSS can be used, I’ll use something similar to what I did on my site’s recent redesign. After coding the inner header element on my site, I realized that the basic structural styles for the inside of the header could be reused on other elements on the page.

So here’s something along the lines of what I had when I started styling my header:

.header-inside {
	width: 980px;
	height: 260px;
	padding: 20px;
	margin: 0 auto;
	position: relative;
	overflow: hidden;
}

A few of the styles listed here are unique to the .header-inside element. But the rest can form a module that I can reuse. So I can abstract the structural styles into their own reusable class. Here’s the result:

.globalwidth {
	width: 980px;
	margin: 0 auto;
	position: relative;
	padding-left: 20px;
	padding-right: 20px;
	overflow: hidden;
}

.header-inside {
	padding-top: 20px;
	padding-bottom: 20px;
	height: 260px;
}

The styles belonging to the .globalwidth class cover the following:

  • A fixed width
  • Centering using margin: auto
  • Relative positioning to create a positioning context for child elements
  • Left and right padding of 20px
  • Overflow set to “hidden” for clearfixing

Now we’re free to use these styles on any elements that require these same characteristics by simply adding that class to the desired element — without writing a single extra line of CSS.

For my site, I reused these structural styles on the primary content element and the inner footer element. Depending on the design, these styles could also apply to a horizontal navigation element that might appear between the header and the content, or any other element that has a fixed-width and needs to be centered on the page.

After adding the “globalwidth” styles to these elements, the markup would look something like this:

<header>
	<div class="header-inside globalwidth">
	</div>
</header>

<div class="main globalwidth">
</div>

<header>
	<div class="footer-inside globalwidth">
	</div>
</footer>

Some may feel that this type of styles abstraction clutters the HTML and goes against the principle of separating markup from presentation.

But putting aside any debates about how this might affect the markup, no one can question that this abstraction has now made it easier to track down and modify the common styles that are used to structure these three elements.

The Media Object

One of the pioneers of the OOCSS movement is Nicole Sullivan. She’s created a reusable module called the media object which, as she explains, can save hundreds of lines of code.

OOCSS

The media object is a great example of the power of OOCSS because it can contain a media element of any size with content to its right. Although many of the styles that apply to the content inside of it — and even the size of the media element itself — could change, the media object itself has common base styles that help avoid needless repetition.

The Benefits Of OOCSS

I’ve already alluded to some of the benefits of OOCSS. Here I’ll expand on these.

Faster Websites

The performance benefits of OOCSS should be fairly clear. If you have fewer styles that are repeated in your CSS, then this will lead to smaller file sizes and thus faster downloading of those resources.

It’s true that markup will be more cluttered and thus create larger HTML files. But in many cases the amount of loss in markup performance will be greatly surpassed by the amount of gain in stylesheet performance.

Another concept to keep in mind is something that the OOCSS wiki refers to as performance freebies. This refers to the fact that every time you reuse something in your CSS, you’re essentially creating new styled elements with zero lines of CSS code. For large, high-traffic projects, these “freebies” could be a crucial performance gain.

Maintainable Stylesheets

With OOCSS, instead of a constantly growing stylesheet full of specificity wars, you’ll have an easy to maintain set of modules where the natural cascade plays an important role.

When making additions to an existing site, you won’t be adding new styles to the bottom of your stylesheet without regard for what came before. Instead you’ll be reusing existing styles and extending your styles based on existing rule sets.

With this type of forethought, it’s possible to create entire pages while coding very little CSS. Any existing CSS modules can serve as a basis for all new pages, and any new CSS will be minimal. In some cases you might even be able to create a new fully-styled page without coding a single line of CSS.

These maintainability benefits also extend to the robustness of your stylesheets. Because the styles are modular, pages built on OOCSS will be less likely to break when a new developer starts to use the stylesheet.

Points Worth Noting

OOCSS has created a great deal of discussion in the community, raising some controversies. Here I’ll try to dispel a couple of common misconceptions.

You Can Still Use IDs

If you decide to work exclusively in an OOCSS manner, then your styles will be based largely on CSS classes, and you won’t be styling elements using the ID selector.

Because of this, many have falsely claimed that OOCSS encourages dropping the use of IDs completely. But this is not true.

The rule to avoid IDs is, more specifically, don’t use IDs in selectors. So it’s perfectly acceptable to use OOCSS principles (and thus avoid styling using the ID selector) while using IDs in your HTML for JavaScript hooks and fragment identifiers.

Of course, you may have a situation where you already have an ID applied to an element that you know is unique to the page. So, you can save a few bytes by avoiding adding a class to that element and instead style it using an ID selector. But even in this instance, it’s much safer to rely on a class to ensure you don’t run into specificity problems in the future.

Dealing With Smaller Projects

For smaller sites and apps, you could certainly make the case that OOCSS would be overkill. So don’t take this article as an advocacy for OOCSS in all circumstances — it will vary depending on the project.

Nonetheless, I think it’s a good idea, at the very least, to start thinking in terms of OOCSS in all your projects. Once you get the hang of it, I’m sure you’ll find it much easier to get it working on bigger projects where the benefits would be more noticeable and relevant.

Some Guidelines For Implementation

Getting started working with OOCSS could take time. I’m still working on it, so I don’t claim to have all the answers and experience in this area.

But here are some things you might want to start doing to help you get into an OOCSS mode of thinking:

  • Avoid the descendent selector (i.e. don’t use .sidebar h3)
  • Avoid IDs as styling hooks
  • Avoid attaching classes to elements in your stylesheet (i.e. don’t do div.header or h1.title)
  • Except in some rare cases, avoid using !important
  • Use CSS Lint to check your CSS (and know that it has options and method to its madness)
  • Use CSS grids

There will obviously be times when some of these rules will be broken, but overall, these are good habits to develop and will lead to stylesheets that are smaller and easier to maintain.

Follow Nicole Sullivan’s Work

If you want to continue learning about OOCSS, the most important person in the industry to keep up with is Nicole Sullivan.

In addition to posting articles regularly on OOCSS on her blog, Nicole has done a number of presentations with accompanying slideshows. Below are some that you might want to check out:

Conclusion

Many people fear the OOCSS ideology because it seems to go against many of the so-called “best practices” we’ve learned. But once the long-term benefits of using OOCSS are understood, I’m sure many developers will become converts.

Overall I think OOCSS has a bright future in CSS development, and it’s a concept that all developers should start incorporating into their projects — at least on some level — to help create Web pages that are faster, more efficient, and easier to maintain.

(il)


© Louis Lazaris for Smashing Magazine, 2011.




  •   
  • Copyright © 1996-2010 BlogmyQuery - BMQ. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress