Introduction to HTML - Part 1 : 9th July 2007



HTML and CSS – The difference

Think of HTML as the structure of the website you are making. It will contain the text, images and links – all put in the correct order – to compose the page that you want to display. CSS is the look and feel of the page. In your CSS you define the colours, fonts, backgrounds and borders surrounding the content you have in your HTML file. We explain below how to attach your CSS file to your HTML file, but read our CSS tutorials for more information on that topic.

A simple HTML page

The best way to learn is by doing, so the following are a few examples of HTML in action. This is, at it’s simplest, a HTML page:

<html>
   <head>
      <title>My Website</title>
      <link rel="stylesheet" type="text/css" href="style.css" />
   </head>
   <body>
      Website Text
   </body>
</html>

That’s it – it’s much more straight forward than you would expect. HTML works on a system of tags, with each one surrounded by <> brackets. Any tag that you open must be closed. This can be done as above with a seperate opening and closing tag (i.e. <body></body>) or using one tag such as below, for a line break, <br />. Here is a brief description of the tags used in the above example:

<html> – This tells your web browser that you want to display a HTML page – everything inside those tags is HTML.

<head> – The ‘head’ is a section where you can show the title of the document and provide information about what the page contains.

<title> – The title is self explanatory, and displays in the title bar of your web browser window.

<link rel="stylesheet" type="text/css" href="style.css" /> – This links the CSS file (style.css) to your HTML document.

<body> – The ‘body’ is the main section. Anything inside the body tag will display in your web browser.

This won’t really do much good though, as it will display a blank page with ‘Website Text’ inside it. The following will explain how to get a little more advanced:

Paragraphs, Line Breaks and Headings

<html>
   <head>
      <title>My Website</title>
   </head>
   <body>
      <h1>Main Heading</h1>
      <p>
         Welcome to my website, full of information
      </p>
      <h2>Second Heading</h2>
      <p>
         Here is some more information about my website, going into
         further detail about what you can look at and how you can navigate
         around.<br />
         If you would like to contact me, you can do so from our contact page.      
      </p>
   </body>
</html>

This is a slightly more advanced example which introduces the idea of defining headings, using the <h1></h1> tags, putting <p></p> around paragraphs, and using <br /> where you just want a normal line break. Having one page is OK, but generally you would want more than one page, with the ability to link them together…

Introduction to HTML Part 2 – Links, Pictures and Lists








Comments and Discussion


There are currently no comments posted on this article. Add yours:

Subscribe


Design Shack CSS Gallery RSS Feed Design Shack News RSS Feed Design Shack Email Newsletter Design Shack Twitter


Tutorial Archives






Sponsored By


PSD to HTML

GoodBarry - The best way for web designers to build online businesses, not websites for their clients. eCommerce, Email Marketing, Content Management, Integrated CRM, Reporting and Analytics and web hosting in one integrated solution.

Gooey Templates

Royalty-free stock images from $0.16

NuBlue UK Web Hosting

Mobile Phone Offers
Unlimited Website Templates
Blog Design


I'd like to be
inspired by:



Colour


Red Designs Blue Designs Green Designs Yellow Designs Brown Designs Orange Designs Brown Designs Grey Designs Multi Coloured Designs


Category




Layout


One Column CSS Layout Two Column CSS Layout Three Column CSS Layout Grid CSS Layout Other CSS Layout


I've got a
question...



What is Design Shack?

We showcase stunning CSS and Web 2.0 design, alongside resources and inspiration for you to succeed in the same way. We only offer the cream of great design, perfect for getting that spark of creativity going again.

Can you feature my site?

Of course - if it's up to the mark! Just fill in our simple form.

Can I help out?

We are looking for new people to help update and maintain the website alongside us. If you're interested, feel free to contact us.