Style attributes allow us to apply CSS style rules to any element on our page.

Later we will see how we can extract common rules into a separate file called a stylesheet.

Making it red

<p style="color:red">Some red text</p>

%p{ style: ‘color:red’} Some red text

Making it bold

<p style="font-weight:bold">Some bold text</p>

%p{ style: ‘font-weight:bold’} Some bold text

Making it bold and red

<p style="font-weight:bold; color:red">Some bold red text</p>

%p{ style: ‘font-weight:bold; color:red’} Some bold red text

Exercise

Using your previous page.

  1. Put a border around the image.
  2. Put some margins around the table to space the page out a little.
  3. Align the th left.
  4. Make the h1 big and red.
  5. Make the h1 italic.

%aside

Downloads