ajax333221
ajax333221

Reputation: 11774

What are the most common CSS practices?

I want to know all the common practices in CSS, those things that you automatically put without really thinking on the Final website deisgn

Example:

body {margin:0;padding:0;}
ul {list-style:none;}
img {vertical-align:middle;border:0;}
a {text-decoration:none;}
a:hover {text-decoration:underline;}
table {border-collapse:collapse;} 
td {vertical-align:top;}

Does anyone know where I can find a complete list of this kind of things?

Upvotes: 0

Views: 309

Answers (4)

Blender
Blender

Reputation: 298582

Everyone suggests CSS resets, but they seem redundant to me.

I'd suggest Normalize.css, as it attempts to normalize CSS across browsers without getting rid of useful properties attached by default to elements like h1, h2, h3, ul, etc.

Upvotes: 1

Alex KeySmith
Alex KeySmith

Reputation: 17111

Yahoo have a nice selection: http://yuilibrary.com/yui/css/

Yahoo Reset

The foundational CSS Reset removes the inconsistent styling of HTML elements provided by browsers. This creates a dependably flat foundation to built upon. With CSS Reset loaded, write explicit CSS your project needs.

CSS Base can complement CSS Reset by applying a style foundation for common HTML elements that is consistent for our browser baseline.

Yahoo base

CSS Base is an optional CSS file that complements YUI's core CSS foundation (CSS Reset and CSS Fonts). CSS Base applies a style foundation for HTML elements that is consistent for baseline browsers.

CSS Base may also be useful as a template for your own base file, or a snippets library for styling HTML elements.

Upvotes: 0

erik
erik

Reputation: 3880

Adding onto @Speed...

This is my favorite CSS reset to start most websites with: Eric Meyer Reset CSS.

Upvotes: 1

Speed
Speed

Reputation: 1434

The best thing to usually start with is a CSS reset. The one I usually use is http://meyerweb.com/eric/tools/css/reset/

The goal of a reset stylesheet is to reduce browser inconsistencies in things like default line heights, margins and font sizes of headings, and so on. The general reasoning behind this was discussed in a May 2007 post, if you're interested. Reset styles quite often appear in CSS frameworks, and the original "meyerweb reset" found its way into Blueprint, among others.

The reset styles given here are intentionally very generic. There isn't any default color or background set for the body element, for example. I don't particularly recommend that you just use this in its unaltered state in your own projects. It should be tweaked, edited, extended, and otherwise tuned to match your specific reset baseline. Fill in your preferred colors for the page, links, and so on.

In other words, this is a starting point, not a self-contained black box of no-touchiness.

Upvotes: 3

Related Questions