|
|
|||||||||
|
</html>
Type the listing in to Notepad and run it as you did before. Note how it now looks. Try resizing the browser until it is has a very narrow width and notice how each paragraph starts to word-wrap.
In HTML, tags can also have attributes which are extra information on how the tag should work. We will now introduce some for the <p> tag. Change the listing so the first <p> now says <p align=right>, and the second says <p align=center>. Save it and either refresh your browser if you still have it open or run the listing as before. You should now see the first paragraph aligned to the left, which is the default, the second to the right and the third in the middle. Resize the browser a few times again to see how the layout changes at different sizes.
To make some text look bigger, you have various options. Modern browsers support all kinds of wonderful tags to control the layout but we’ll look just look at the basic HTML codes here. To create a heading for a page, you use the heading tags which are called <h1> through to <h6> with <h1> being the biggest. Don’t forget to mark the end of the text you want to show in each heading with the corresponding end tag e.g. </h1>. Type the following in to a new file in Notepad to see how they work.
<html>
<head>
<title>My first web page</title>
</head>
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
</html>
Save the file and run it to see what happens. You should see six lines of text all at different sizes. Quite how headings are displayed is down to the browser so you may also see different colours, italics or other such features used to differentiate each line. As a rule you would use <h1> at the top of a page for the main title and perhaps <h6> within the body of the text to highlight copyright information or disclaimers. The others can be used throughout the rest of the document to highlight text as required.
Like the paragraph marker <p>, the heading can have attributes added so try inserting align statements to see how the results look e.g. <h1 align=center>
In part 3 we’ll look at how to change individual words or characters. In the meanwhile, try variations of the examples above and see how you can mix and match tags.
|
|