The h1 tag indicates the primary header of the document.
Some text.
The template structure
======================
.. highlight:: html
Preamble: How to write a HTML document
--------------------------------------
This is actually pretty simple: HTML is written as a plain text
document. A HTML file always uses the extension **.html** to indicate
its filetype.
Text editor
-----------
You will need a plain text editor in order to edit HTML files.
You can also get fully graphical WYSIWYG (What You See Is What You Get)
HTML editors, that let you edit the web page graphically with a similar
interface to programs like Word. These can be useful, but many people
working with HTML & CSS prefer a plain text editor and that's what we'll
be using today.
If you already have a plain text editor installed (perhaps from a
previous OTS workshop) then you'll be fine. Otherwise here are some
suggestions:
Windows
~~~~~~~
`Notepad++
`` tag indicates a paragraph of text is in that element, and the ``
This is a paragraph.
You can see the closing tag includes a ``/`` before its name; otherwise it would be another opening tag! **Always** double-check that you've closed all your elements; otherwise, a browser can and will get mixed up trying to understand your HTML document. There are some specific elements that are exceptions to this rule. When elements cannot contain anything else, then they don't need to be closed. For example, the following elements are referred to as 'self-closing': ::This is a sentence, with a em element ("emphasize") inside it.
or this: ::Some text.
And I'm a paragraph!
Heading elements are straightforward to understand. They start from h1 with the biggest font and importance, going to h6 with the smallest font. Indentation ----------- Are you wondering why we wrote the h1 and p tags *indented* inside the body tags? That will not change at all how the browser reads or interpretates the document, but it is a good practice among developers to write code like that in order to have a more clear document and still be able to work with it even after a long time or when there is a lot of lines of code. It also shows the heircharcical nature of HTML pretty well. Comments -------- It is also possible to put "comments" in your HTML. Comments in HTML are there to remind you (or other people editing the HTML file) without changing the way the page displays in a browser. Like other HTML elements, comments are written by using a tag. Although comment tags look a little different: :: The "start comment" tag is ````. Comments can also enclose other HTML elements, to "comment them out". This is a useful technique when you're experimenting with a page to see how it looks when you change things around. For example, try commenting out the ``h1`` heading in your current page: ::And I'm a paragraph!
If you reload the page in your browser, you'll notice the heading has vanished. Remove the comment tags (so the heading appears again) before moving on to the next section. Images ------ Headings and paragraphs give you the basics of text. What about images? Images have to kept in separate image files, outside the HTML file. Find a favourite image on the web and save it in the same directory as your HTML file (right-click the image in your browser and "Save Image..."). If you don't have a picture in mind then `here's a page with a photo of some kittens that you can useAnd I'm a paragraph!
Well now we're just blathering on.
Notice that the kitten image is part of its own paragraph here, so it is shown on a new line in the browser. Hopefully the document in your file looks similar, but not exactly the same. You might have changed some of the text... does it all work in your browser? Why not use a visual editor? ---------------------------- Visual editors exist, and some people use them. This is sometimes referred to a "what you see is what you get" editing, or WYSIWYG. In the long run, it can be limiting to use a visual editor because there are ways of changing text that are faster and easier to specify manually. It also limits your ability to understand what's happening on the page if you only use generated code from a visual editor. Why not use MS Word as a text editor? ------------------------------------- MS Word has a lot of formatting information that can't be understood by the web. The way Word knows where to put a paragraph (or bigger font sizes, or a picture, or anything) is totally different from how HTML and CSS work. For code of all kinds, including HTML and CSS, it's important to use a text editor to keep your code clean. In addition, text editors provide some hints about what pieces of code you have where. This is called syntax highlighting. It is like showing nouns in red and showing the verbs in blue in a sentence. What's next? ------------ You may be thinking at this stage that your HTML page looks pretty bland. How can you spice it up a little? Read on to find out in the next section, `your first styled Hello World!