Using Basic Styles

Lesson 6

  1. Click ‘File’ & ‘Close’ to close any files that appear.
  2. Navigate to the folder called ‘Website Files’ on your network and open Lesson5.html

You will now see the following code:

Code inserted in page

Note that there is more HTML in this file than you would have seen in previous lessons, these contain:

  1. Click at the end of line 17 and press return.
  2. Now type the following tag <hr>
  3. ‘Save’ and ‘Run’ your page – what happens? – You should see a horizontal line below your text.
  4. Now delete the <hr> tag and remember to ‘Save’ your page.
  5. Go to line 15 and click after <p and press space
  6. Type style=”border:#F00 dashed thick”
  7. ‘Save’ and ‘Run’ your page – what happens? – This will place a border around your text that is Red, in a dashed style and is thick.

My name is...XXX Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi venenatis, mi ac tincidunt pulvinar, enim arcu hendrerit arcu, sit amet mollis arcu est et mauris. Phasellus convallis scelerisque est vitae venenatis. Integer convallis elementum metus vel dignissim. In in neque a felis placerat venenatis. Sed urna purus, consectetur a cursus ut, dignissim vel elit. Ut massa arcu, semper quis rhoncus vitae, ultricies a nisi. Proin ac erat orci, vel consequat arcu. Vivamus augue dolor, laoreet molestie pharetra in, elementum et mi.

You can replace the ‘dashed’ style with:

  • Dotted
  • Double
  • Inset
  • Groove
  • Hidden

You will notice that the text in your box is right up against the sides of the box, to move this in we need to apply ‘padding’, to do this:

  1. On line 15 add ; padding:10px; to the end of border:#F00 dashed thick
  2. ‘Save’ and ‘Run’ your page – What happens?

You should see that the text has moved inwards:

My name is...XXX Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi venenatis, mi ac tincidunt pulvinar, enim arcu hendrerit arcu, sit amet mollis arcu est et mauris. Phasellus convallis scelerisque est vitae venenatis. Integer convallis elementum metus vel dignissim. In in neque a felis placerat venenatis. Sed urna purus, consectetur a cursus ut, dignissim vel elit. Ut massa arcu, semper quis rhoncus vitae, ultricies a nisi. Proin ac erat orci, vel consequat arcu. Vivamus augue dolor, laoreet molestie pharetra in, elementum et mi.

Take me to lesson 7 'Creating Lists'

Scroll to Top
Scroll to Top