Wednesday, July 27, 2011

CSS Questions

1. How do you set the background colour of your website? You use the following tag body {background-color = #FFF}

2. How do you set a background image and repeat it horizontally?

body{background-color: #FFCC66;
background-image: url("butterfly.gif");background-repeat: repeat-x

3. How do you set the font size of all paragraphs to be 14px? body {font-size: 14px;}

4. How do you underline text? h1 {text-decoration: underline;}

5. What is a pseudo-class? A pseudo-class allows you to take into account different conditions or events when defining a property for an HTML tag.

6. How do you set the colour of all links on your website to be red? a:link {color: red;}

7. How do you set the roll-over colour of all links to be orange? a:hover {color: orange}

8. What is the Box Model? The box model in CSS describes the boxes which are being generated for HTML-elements. The box model also contains detailed options regarding adjusting margin, border, padding and content for each element.

9. What are the two ways we can increase space around content?

body{margin-top: 100px; margin-right: 40px; margin-bottom: 10px;margin-left: 70px;}

body {margin:100px 40px 10px 70px;}


10. What is the purpose of the ‘div’ tag? The
tag defines a division or a selection in a HTML document. It is often used to group block-elements to format them with styles.

11. When is a 'class' more appropriate to use than an 'id'? When dealing with larger amounts of information class is often more appropriate. Id is more so used for unique bits of code to define a unique style.

12. What is a floating element and when is it useful? An element can be floated to the right or to left by using the property float. That is to say that the box with its contents either floats to the right or to the left in a document. Used for the placing of images and text to make a neat and tidy page.

No comments:

Post a Comment