1. Computing

Discuss in my forum

CSS FAQ - Frequently Asked Questions About Cascading Style Sheets

By

CSS Basics

What is CSS?
CSS is an acroynym. It is what designers use to build styles to define the look and feel of web documents.

What is a Style Sheet?
A style sheet is used to create CSS documents. Sometimes it is used interchangeably with the term CSS.

What should I name my CSS style sheet file?
It's mostly up to you, but you should give it an extension of .css.

What does Cascade mean in Cascading Style Sheets?
This part of CSS is often overlooked, and it's an important thing to know when trying to figure out why your styles aren't applying as you think they should.

How do you link an external style sheet?
There are two ways to add external style sheets to your web pages. Linking is the most common method.

What's the Difference Between @import and link for CSS?
This is the other way you can attach external style sheets.

Is CSS case sensitive?
The short answer is no, but it's still a good idea to use all lowercase.

Why Don't my CSS Colour Styles Work?
Beause CSS is written in American English, for better or worse.

Class versus ID in CSS

Why must the ID attribute be unique on each page?
The id attribute gives you a unique identifier. But only if you only use it once per page.

When Should You Change a Class to an ID Attribute?
Find out more about the difference between classes and ids.

Why Do Browsers Allow Duplicated IDs on the Same Page
Remember that just because browsers allow it doesn't mean it's correct.

What is the Point of Having an ID and a Class Attribute When They Act the Same?
They really do offer different features.

Using CSS Features

What is the Comma for in CSS Selectors?
Avoid repetitions in your style sheets by separating multiple selectors that have the same style with a comma (,).

How do you comment a CSS document?
Adding comments to CSS helps you keep it clear and helps you or your teammates remember what styles are meant to do.

What does !important mean in CSS?
The !important rule is very useful for forcing styles quickly.

What font units are available in CSS?
There are many different ways to write the size of your fonts with CSS.

What's the difference between display: none and visibility: hidden?
They are different, although some people try to use them interchangeably with poor results.

How does the vertical-align style property work?
It doesn't work the same way that the align property does.

Tricks for Using CSS

How Can I Create a Watermark on a Web Page?
Essentially, a faded image that stays in one place on the screen.

How can I create a variable-width container without a table?
Until the display: table; property is widely supported, your best choice is to just use a table.

Can You Fix a Background Image to the Bottom of a Table?
Yes, but it's hard.

How Do you Stretch a Background Image in a Web Page
You must use CSS 3 properties.

Writing Different Types of Style Sheets and CSS

How do you write a print style sheet?
You can even style your documents for printing with CSS.

What is a User Style Sheet?
These style sheets let you decide how you want to view web pages and override what designers want.

What is the difference between a user and an author style sheet?
These are the style sheets that most web designers use.

If you have a question about CSS that isn't answered here, I'd love to hear about it.

  1. About.com
  2. Computing
  3. Web Design / HTML
  4. Cascading Style Sheets
  5. CSS FAQ - Frequently Asked Questions About Cascading Style Sheets

©2014 About.com. All rights reserved.