Tuesday, March 15, 2011

CSS Interview Question Part I

1. Explain in brief about the term CSS.
A stylesheet language used to describe the presentation of a document written in a markup language. Cascading Style Sheets are a big breakthrough in Web design because they allow developers to control the style and layout of multiple Web pages all at once.

2. What are the various style sheets?
Inline, external, imported and embedded are the different types of style sheets.

3. List various font attributes used in style sheet.

font-style
font-variant
font-weight
font-size/line-height
font-family
caption
icon
menu
message-box
small-caption
status-bar

4. Explain inline, embedded and external style sheets.

Inline
If only a small piece of code has to be styled then inline style sheets can be used.

Embedded
Embedded style sheets are put between the <head> </head> tags.

External
If you want to apply a style to all the pages within your website by changing just one style sheet, then external style sheets can be used.

5. Are Style Sheets case sensitive?
No. Style sheets are case insensitive. Whatever is case insensitive in HTML is also case insensitive in CSS. However, parts that are not under control of CSS like font family names and URLs can be case sensitive - IMAGE.gif and image.gif is not the same file.

6. What is selector?
CSS selector is equivalent of HTML element(s). It is a string identifying to which element(s) the corresponding declaration(s) will apply and as such the link between the HTML document and the style sheet.
For example in P {text-indent: 10pt} the selector is P and is called type selector as it matches all instances of this element type in the document.
in P, UL {text-indent: 10pt} the selector is P and UL (see grouping); in .class {text-indent: 10pt} the selector is .class (see class selector).

7. Can I include comments in my Style Sheet?
Yes. Comments can be written anywhere where whitespace is allowed and are treated as white space themselves. Anything written between /* and */ is treated as a comment (white space). NOTE: Comments cannot be nested.


1 comment: