Toolbox CSS


What is Toolbox CSS?

Toolbox CSS is styling information that has nothing uniquely to do with any particular website. These are a collection of common styles that can be useful on any web project. How many times have you written a class for clearing a float? Too many, is my guess. The idea with Toolbox CSS is to include a separate stylesheet for these “utility” styles.

What ISN’T Toolbox CSS?

Toolbox CSS isn’t a CSS reset. Toolbox CSS isn’t a CSS framework. Toolbox CSS contains none of the styling “soul” that makes any web project unique.

Why use Toolbox CSS?

Using Toolbox CSS will save you time. It saves you from writing the same styles over and over and over. Need to float something to left? You can always count on your toolbox. It also helps you keep consistency amongst your sites. If you always use the same toolbox, your markup will share the same common class names and makes it easier for you to jump back into and understand.

The Code

The code for the Toolbox CSS is below. Or, use the direct link.

/*
         Toolbox CSS
	 Chris Coyier
	 http://css-tricks.com
*/
/*
	LAYOUT TOOLS
*/
.floatLeft 			{ float: left; }
.floatRight			{ float: right; }
.clear				{ clear: both; }
.layoutCenter			{ margin: 0 auto; }
.textCenter			{ text-align: center; }
.textRight			{ text-align: right; }
.textLeft			{ text-align: left; }
/*
	PRINT TOOLS
*/
.page-break 			{ page-break-before: always; }
/*
	TYPOGRAPHIC TOOLS
*/
.error				{ border: 1px solid #fb4343; padding: 3px; color: #fb4343; }
.warning			{ border: 1px solid #d4ac0a; padding: 3px; color: #d4ac0a; }
.success			{ border: 1px solid #149b0d; padding: 3px; color: #149b0d; }
.callOut			{ font-size: 125%; font-weight: bold; }
.strikeOut			{ text-decoration: line-through; }
.underline			{ text-decoration: underline; }
.resetTypeStyle			{ font-weight: normal; font-style: normal; font-size: 100%;
					  text-decoration: none; background-color: none; word-spacing: normal;
					  letter-spacing: 0px; text-transform: none; text-indent: 0px; }
/*
	STYLING EXTRAS
*/
a[href^="mailto"]		{ background: url(images/emailIcon.png) left center no-repeat; padding-left: 10px; }
a[href~=".pdf"]			{ background: url(images/pdfIcon.png) left center no-repeat; padding-left: 10px; }
a.button			{ color: black; border: 1px solid black; padding: 3px; }
	a.button:hover		{ background: black; color: white; }
.transpBlack			{ background: url(images/transpBlack.png); }
/*
	DISPLAY VALUES
*/
.hide				{ display: none; }
.show				{ display: block; }
.invisible			{ visibility: hidden; }

A Little Explanation

The Page Break: By inserting the “page-break” class, a new page will be started when printing the website to a printer. Useful before large images or major sections.

Styling Extras: These make reference to a couple of image files that I haven’t included here. There are lots of places for you to find nice icons, try Icon Finder.

Display Values: There is a difference between display: none and visibility: hidden. Setting the display value to none will remove the layout box from the page, causing re-flow. Sometimes desirable, sometimes not. If you simply wish to hide an element but leave the space that it occupied intact, use the visibility attribute.

del.icio.us:Toolbox CSS digg:Toolbox CSS spurl:Toolbox CSS wists:Toolbox CSS simpy:Toolbox CSS newsvine:Toolbox CSS blinklist:Toolbox CSS furl:Toolbox CSS reddit:Toolbox CSS fark:Toolbox CSS blogmarks:Toolbox CSS Y!:Toolbox CSS smarking:Toolbox CSS magnolia:Toolbox CSS segnalo:Toolbox CSS gifttagging:Toolbox CSS

21 Responses »

  1. [...] View Article on Tutorial Blog [...]

  2. I was taught that for a “.clear” class, you should have

    height: 1px;
    line-height: 1px;
    font-size: 1px;
    margin-top: -1px;
    clear: both;

    Is this overkill? My understanding was this was for fixing some IE problems.

    Thoughts?

  3. A demo page for these would be nice, it’s obvious what some sill do, the typography classes are not quite as obvious.
    Thanks, better than a framework, and simple!

  4. Looks great! I really like the Styling Extras section. Most useful, forehead-smacking win for me is the resetTypeStyle class… brilliant. Legal questions - if we modify this heavily do we add our name as a mod in the pseudo-copyright area? If we remove it altogether will you hunt us down and… ?

  5. @Pat I’ve seen that kind of thing before, but I think it’s unnecessary. I’m not quite sure what problem this actually solves and it looks like it might actually cause more potential problems than it solves. I’m open to hearing more about it though!

    @Kevin: You can do whatever you want with it, go ahead and remove the name, I don’t mind!

  6. Pretty good idea…

  7. [...] Toolbox CSS es simplemente un fragmento de código CSS que no está relacionado con ningún sitio web en particular, para que puedas copiar y usar directamente en tus proyectos. La idea es que no escribas 1.000 veces la misma clase para una propiedad float. [...]

  8. Nice article and tool’s CSS!

    I did find a small error though : the line: a[href~=".pdf] … is missing a ” after the word pdf and thus the CSS will stop right there with excecution. It should read correctly: a[href~=".pdf"] … .

    Keep up your good work, love your articles.

  9. @Pat - over kill…

    KISS is always the best method.

    @Chris - This is much better than a silly reset or some framework that only adds bloated junk to websites.

  10. [...] Дополнительная информация доступна на сайте http://www.tutorialblog.org CSS, Веб-разработка 0  Loading [...]

  11. @Marlyse Thanks, that indeed was a syntax error in the code displayed in the article, I have that fixed.

  12. [...] Toolbox CSS But your code may become ‘presentational’ [...]

  13. What browsers support this stylesheet?

  14. This is a big step backwards if you believe design and structure should be separated. It’s really only a shortcutted version of using inline styles… not exactly ideal.

  15. @Tobias I agree, class’s should describe the content they mark up, so a style-sheet can apply the style for a particular situation, design, or page.

    @Jermayn reset style-sheets are nice if your worried about keeping things like font sizes, line heights, margins etc.. consistent across multiple browsers. There are some that may be bloated, but generally they serve a more universal function imo.

  16. [...] » Toolbox CSS (tags: CSS tools reference tips) [...]

  17. [...] » Toolbox CSS Toolbox CSS is styling information that has nothing uniquely to do with any particular website. These are a collection of common styles that can be useful on any web project. How many times have you written a class for clearing a float? Too many, is my gu (tags: internet reference web-developer web-developer/tools web-developer/css) [...]

  18. [...] » Toolbox CSS (tags: css toolbox tips) [...]

  19. [...] Toolbox css En samling vanligt förekommande css-regler att infoga till ditt webbprojekt. (tags: css snippets code tips) [...]

  20. [...] you referring to? hopefully these will see you sorted If it is the toolboxCSS then follow this Toolbox CSS If it is the YahooUI link that is dead try this The Yahoo! User Interface Library (YUI) [...]

  21. [...] » Toolbox CSS (tags: css css-library) [...]

Leave a Reply

Comments for this post will be closed in 4 days.

Ad-Links

Translate



Fatal error: Call to undefined function: wp_foot() in /home/tutorial/public_html/wp-content/themes/default/footer.php on line 21