CSS

What is CSS?

  • CSS stands for Cascading Style Sheets
  • Styles define how to display HTML elements
  • Styles were added to HTML 4.0 to solve a problem
  • External Style Sheets can save a lot of work
  • External Style Sheets are stored in CSS files

CSS Example

CSS declarations always ends with a semicolon, and declaration groups are surrounded by curly brackets:

Cascading order

What style will be used when there is more than one style specified for an HTML element?

Generally speaking we can say that all the styles will “cascade” into a new “virtual” style sheet by the following rules, where number four has the highest priority:

  1. Browser default
  2. External style sheet
  3. Internal style sheet (in the head section)
  4. Inline style (inside an HTML element)

So, an inline style (inside an HTML element) has the highest priority, which means that it will override a style defined inside the <head> tag, or in an external style sheet, or in a browser (a default value).

I have now been able to use CSS to create the BBC background for my archive. This is something that I have been trying to do for a while. It is not centred when the screen is stretched, but this is not the main issue at present.

As I now have the background for the site I can try and progress to get the elements on to the screen in their correct positions.

 

<style type=”text/css”>

body

{

background-image:url(bbc_background.jpg’);

background-repeat:no-repeat;

}

</style>


 

Advertisements
This entry was posted in PG04 - Prototyping. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s