0

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?

4
  • There is no such thing as "basic practices". Everyone has different tastes & preferences. Each situation and website is unique. Commented Nov 14, 2011 at 17:16
  • @Sparky672, Some people prefer to start from scratch, others don't... It is your opinion and I respect it Commented Nov 14, 2011 at 17:19
  • You missed my point, which is not an opinion. You are asking for something which has no single answer. Everyone's "best practices" are different. Please note the nature of answers below... they do not really answer your question... a "CSS Reset" merely "resets" all browsers to a common CSS starting point. You will still have to write your own CSS from scratch on top of that. Maybe a CSS Reset is really what you wanted, but it's not entirely clear in your question. Commented Nov 14, 2011 at 17:24
  • I'm sure he phrased it incorrectly, it's more 'common' practices than 'best'. Commented Nov 14, 2011 at 17:28

4 Answers 4

3

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.

Sign up to request clarification or add additional context in comments.

Comments

1

Adding onto @Speed...

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

3 Comments

I am not sure if he edited and stole your link. When you posted this, did he had the same link?
I posted an answer and then expanded it the same minute with the link (I wasn't sure if I'd find it in my bookmarks). I'm pretty sure I was faster.
I don't really care...it wasn't there when I posted it. We prob posted at the same time.
1

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.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.