Wednesday, July 27, 2011

CSS questions

  1. How do you set the background colour of your website?
    you set out the code like so:
    body {background-color: #000000;}

  2. How do you set a background image and repeat it horizontally?
    in the body section after the body colour and the image url line, have this-
    background-repeat: repeat-x;

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

  4. How do you underline text?
    you use the line:
    text-decoration: underline;

  5. What is a pseudo-class?
    This is a term used to categorise a link if it has been visited, unvisited, active, or looks different if you hover over it.

  6. How do you set the colour of all links on your website to be red?
    a: {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?
    This is what describes the area around an element.

  9. What are the two ways we can increase space around content?
    a margin- eg: body {margin: 100px 50px 100px 50px;}
    or padding, if it is a heading- eg: h1 {background: orange; padding: 50px 50px 50px 50px;}

  10. What is the purpose of a 'div' tag?
    to divide text elements into groups and then give them different styles.

  11. When is a 'class' more appropriate to use than an 'id'?
    When you are needing to classify a whole group or paragraph seperate from others, and when there is more text than one line or word (which is when id would be more useful)

  12. What is a floating element and when is it useful?
    It is when a body of text is set to go around, or to the side of an element (or picture). This can be useful if you want to keep an even amount of space between all elements (or images)

1 comment: