Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
com
With that out of the way, we can tackle the actual HTML part. It looks like this:
<html>
Well, what did you expect? This is a good place to throw in that almost every HTML tag opens and MUST also be closed. Its good practice to write the opening and closing tags at the same time, and fill in after maybe it seems odd, but itll save you a few headaches down the line. As a matter of fact, many editors create the opening and closing tag at the same time and even put your cursor politely smack in between, so you can start entering your content. Note that I said almost every HTML tag. There are a few exceptions, here are some commonly used basics:
<br> - This creates a <hr> - This creates a <img> - The image tag <meta> - That's a tag to later line break 'header row' - it's just a line ... - that's what we need to insert pictures that belongs into the head section, which we'll get
There are more, but those are the most commonly used ones. And our earlier doctype tag does NOT need to be closed, either. So now, we have this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> </html>
The / in the second html tag indicates that its the closing tag. Inside this outer container of our page, we need two subsections: the head (section) and the body. And now it looks like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> </head> <body> <body> </html>
url:ibtoffers.com seekers:www.ibtoffers@gmail.com
And when we load this up to a server, and look at it with our favorite browser, we see ABSOLUTELY NOTHING. This is not an error, we have not added anything to be seen yet so far, we have only created the very basic structure of an HTML page. (P.S. if you right-click the ABSOLUTELY NOTHING page, in most browsers youll see a box of options, and one of them will likely be View Source click that, and youll see the pages code.)
The Charset
The charset (character set) lets the browser know how to read and display the characters (letters, numbers, symbols) that are used in our HTML page. There are a great variety, depending on the type of letters (think Hebrew, Russian, Japanese, for example). Its a science all on itself, but since we want to build a website and not study "The Rise and Fall of the Document Character Set" or "How Young ISO Explores the World", using Western characters and symbols, were usually fine using a universal charset:
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
Note how this line begins with the word meta. Meta tags, part of the head section, will be discussed in more detail later, but since the determination of the proper charset is important to the browser, well feed it this bit of info right away.
Meta Tags
People viewing your website will not see if you have meta tags or whats in them. They are important none-the-less, as they provide additional information to the browsers and some of them can actually influence what appears on the monitor. There is a long laundry list of different meta tags available, but for the purpose of this tutorial, well stick the most basic, commonly used ones.
<meta name="description" content="Give a brief description about the content of your page - this will show in search results."> <meta name="keywords" content="Provide relevant keywords to help search engines find your site.">
<meta name="keywords" content="Provide relevant keywords to help search engines find your site."> <meta name="copyright" content="Pretty self-explanatory - here, I'd write: www.killersites.com"> <meta name="author" content=" Andrea Barnett for www.killersites | www.how-to-buildwebsites.com"> <meta name="ROBOTS" content="index, follow"> <link rel="stylesheet" type="text/css" href="external-stylesheet.css"> <head> </head> <body> </body> </html>
The VERY Basic HTML Structure The Body Section CONTENT & Basic HTML Tags
Now that weve taken a look at the boring, but very necessary, basic structural parts, were getting to some basic HTML tags that actually help define and display our content. Ive mentioned (cascading) stylesheets (CSS) earlier those are used to position and format our page. The HTML presents the content in a logical manner. Lets ignore CSS and all it can do for now, while were looking at some of the basic, frequently used HTML tags.
url:ibtoffers.com seekers:www.ibtoffers@gmail.com
Header tags are used to format headers. They are numbered, with the h1 tag for the most important header (or title) on your page (often the site name), the h2 tag the second most important header/title, and so on. Think header(s) and sub-header(s). This page shows header tags 1 to 6, as they appear without any formatting applied: HTML Header Tags.
The paragraph tag is for just what it says: paragraphs. They belong around individual paragraphs of text and define those and the space around/ between them. Here are a couple properly coded paragraphs as they appear, only formatted and styled by the browser defaults. The Paragraph Tag
List Tags
Lists are often misunderstood, but the list tag and html has an ordered and an unordered one is useful for all kinds of stuff. Aside from your basic numbered (ordered list = ol), bullet (unordered list = ul) there is your navigation which is actually an unordered list, that can be displayed horizontally or vertically but that is part of what CSS can do, and that is a different lesson.
And this is what this looks like: Ordered and Unordered Lists. There is one more aspect to lists, and they can be used by either ordered or unordered ones, and those are lists with subcategories. The code to an unordered list with 2 levels looks like this:
<ul> <li> <ul> <li></li> </ul> </li> </ul>
So for example:
<a href="http://www.killersites.com">www.killersites.com</a>
or
<a href="http://www.killersites.com">A Great Place to Learn</a>
take you to the same place. If you see those 2 links on a page, the first one would look like this(Make sure to hit your browsers back button after clicking the following links this lesson isnt over yet): www.killersites.com and the second one like that: A Great Place to Learn. But each takes you to the same place. Im pointing that out to demonstrate that the description really is irrelevant its just to give the cursor something to grab what matters is the part following the http. The above link takes us to a different website. But we can also link to a different page within the same site.
<a href="how-to-build-websites.com/basic-concepts/part1.php">A page on this site</a>
This would appear like this: A page on this site. Note how theres no http? The http, which stands for Hypertext Transfer Protocol, takes us way out into cyberspace, and from there, we can reach anything. But since this time, we only want another page inside this website, we dont have to reach out that far, and the http isnt needed.
I want to mention that this way of bookmarking is a more current method the old way to create the bookmark looked like this:
<a name="top">Top of Page</a>
The way to link to it is the same. This old way isnt wrong, just outdated. Best to stick to the idmethod.
url:ibtoffers.com seekers:www.ibtoffers@gmail.com
So technically, all we do is create another hyperlink. That, however also means that we have to make sure that we upload the image as well. An image that only sits on our computer wont show up online. At best, youll get the red X or, depending on your browser, nothing at all. To insert that image, and here Im assuming that the image is saved in the exact same folder as the document were working with (that is important as is affects the path), it takes the following code:
<img src="image.jpg" alt="description of image">
The attributes are pretty much self-explanatory. img is short for image, src is short for SouRCe and remember that word. For some reason, writing scr instead of src is a common mistake and then the image wont show. But if you keep thinking source, you should be able to get the r and c in the correct order. And lastly, theres the alt tag. That stands for alternate text and is required. There we describe whats on the image for those who cannot see the image the visually impaired, screen readers, or for those that cant display images for whatever reason. There are other useful attributes: height and width, and title (that creates the text box that pops up when one hovers over the image). In order to display the following image
in a regular html website, assuming the image was stored in the same folder as the html page, it would require this code:
<img src="image.jpg" alt="Seedpod on a Japanese Bush" title="Seedpod" width="391" height="293">
If you were to view the source of this tutorial page, youd see that the code was a bit more complex that what Ive just shown you thats because this website runs on a WordPress Platform, which affects where files are stored, among other things. One last thing to mention above is all based on an HTML website with and HTML doctype. If you were using an XHTML doctype, the image tag would need to be closed by adding a closing slash so for XHTML it would need to look like this:
<img src="image.jpg" alt="Seedpod on a Japanese Bush" title="Seedpod" width="391" height="293" />
And one last comment about images: make sure that the width and height are the actual dimensions of the image technically, you could display any size image in exactly the size you specify, but that might distort the image. Also, the image is loaded at whatever size it truly is, not the size its displayed, so by loading a large image but displaying it smaller, youre wasting
url:ibtoffers.com seekers:www.ibtoffers@gmail.com
3, Row 2, Cell 3</td> 1, Row 3, Cell 1</td> 2, Row 3, Cell 2</td> 3, Row 3, Cell 3</td>
and this looks like this. The tags are mostly self-explanatory. table is of course for table, tr stands for table row and td is for the cell (dont know why they didnt just use tc). The default of a table is border-setting 0 so adding a border makes the table appear more defined. Ideally, that would be done in the CSS, but for the purpose of this HTML Table tutorial, well add it inline:
<table border="1">
and now, our table looks more like a table: Table with Borders There are other html tags available to be used in tables
<caption> - Table Caption <th> - Table Header (cell) <thead> - Table Header content (row) <tbody> - Table Body <tfoot> - Table Footer <colgroup> - Used to define and format a group of columns <colspan> - Merges multiple cells across columns <rowspan> - Merges multiple cells across rows
This code:
<table border="2"> <caption>This is the Table Caption</caption> <thead> <tr> <th>Column 1</th> <th>Column 2</th> <th>Column 3</th> </tr> </thead> <tr> <td colspan="2">Column 1 and 2, Row 1, Cell 1 and 2</td> <td>Column 3, Row 1, Cell 3</td> </tr> <tr> <td>Column 1, Row 2, Cell 1</td> <td>Column 2, Row 2, Cell 2</td> <td rowspan="3">Column 3, Rows 2, 3, 4, Cell 3</td> </tr> <tr> <td>Column 1, Row 3, Cell 1</td> <td>Column 2, Row 3, Cell 2</td> </tr> <tr> <td>Column 1, Row 4, Cell 1</td> <td>Column 2, Row 4, Cell 2</td> </tr> <tr> <td>Column 1, Row 5, Cell 1</td> <td>Column 2, Row 5, Cell 2</td> <td>Column 3, Row 5, Cell 3</td> </tr> </table
And this is how this appears on the page note the different spacing line breaks just end one line and take you to the next, whereas a paragraph break the <p>tag actually creates space. Wer reitet so spt durch Nacht und Wind? Es ist der Vater mit seinem Kind; Er hat den Knaben wohl in dem Arm, Er fat ihn sicher, er hlt ihn warm. Mein Sohn, was birgst du so bang dein Gesicht? Siehst, Vater, du den Erlknig nicht? Den Erlenknig mit Kron und Schweif? Mein Sohn, es ist ein Nebelstreif. (For the purpose of this lesson, Im ignoring the proper use of HTML entity codes to create quotes and those funky German letters.) An address is another good example of the proper use of the <br> tag:
<p>John Doe<br> 123 Main Street<br> Some Town, USA<br> 555-555-5555</p>
Another situation where the <br> tag is frequently misused is around images to create space above and/or below them. While this:
<br> <br> <br> <br> <br> <img src="http://www.killersites.com/community/public/style_images/Killersites2/logo.png" alt="The Killersites Frog"> <br> <br> <br> <br> <br>
creates that:
url:ibtoffers.com seekers:www.ibtoffers@gmail.com
no guarantee that they will continue to do so. At least some of them will NOT be supported by HTML 5. And since using CSS is a much better, cleaner way to do things then why NOT use it? After all, your 80s hairdo still works, but would you really???? And here is a list of the deprecated tags:
<applet> - (inserts an applet) <basefont> - (sets the default font) <center> - (centers text) <dir> - (directory list) <font> - (font, its size and color) <isindex> - (searchable document index) <menu> - (menu list) <s> or <strike> - (both create strikethrough text) <u> - (underline) <xmp> - (preformatted text>
And here is the CSS for the most frequently still (ab)used of these dead tags. This is how its done nowadays:
<center>
text-align: center;
<font>
font-family: Baskerville, "Times New Roman", Times, serif;
(Note how Times New Roman a multi-word font name, is enclosed by quotes.)
<s> or <strike>
text-decoration: line-through;
<u>
text-decoration: underline;
And by tying this stylesheet with above information to every page of your site, every page will now have a green background. That means you define it ONE TIME and dont have to worry about it again. It also means that, lets say youve just finished all 159 pages of your website, and you just decided that maybe the green background isnt right after all blue would be much better
Then all you have to do is save this .css document, upload it, and TA-DAAAA your entire sites background is now blue. Just like that!
And you will call this document style.css and save it into the same directory your index.html file is in. But if you look at your index.html page in your browser now, you wont see any of the colors we determined in style.css. In order to actually see the pretty colors, we have to link the stylesheet to the html document. And that is done with this code:
<link href="style.css" rel="stylesheet" type="text/css">
And this line needs to go into the head section of your HTML document so here:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>A Good Title for this Page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" type="text/css" href="style.css"> </head>
Now make sure that style.css and this new version of your HTML page are also uploaded to your hosting account, refresh the html page, and youll see Then there is:
url:ibtoffers.com seekers:www.ibtoffers@gmail.com
Internal Styling
Instead of using the external stylesheet, you could add all the styling directly into the head section of each page that would look like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>A Good Title for this Page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> body { background-color: #ffffff; color: #000000; font-family: Arial, sans-serif; } p { padding: 15px; } h1 { color: FF0000; font-family: "Wide Latin"; } </style> </head>
This is a method thats useful for styling that only applies to the very page this is inserted into so likely not the stuff we defined above. A good example for when internal styling would be practical is the contact page of your site the styling for the contact form (likely) wont be needed anywhere else on the entire site, so adding the parts that address just those tags only on the contact form makes good sense. The reason that using internal styling for stuff like the body and h1 tags is not a good idea at all is simple. Lets say you used the above for your new site and now, that all 159 pages are done, you decide you really should change the color of the h1 tags. And now youd have to open every single one of those 159 pages and make that change. NOT very efficient, right? And lastly, we have:
Inline Styling
In addition to the above external stylesheet (for all the pages on the site) and the internal styling (for all the styles on that ONE page), there is also inline styling. This is practical if you are styling just one thing one single time on your entire site. Maybe there is this ONE paragraph on that ONE page that you want to stick out but only that very one on the entire site. Then you could use incline styling like so:
<p style="border: solid 5px #FFAA00;"> The very special paragraph that shows up only ONE time on this ONE page on the ENTIRE site - only here, nowhere else. Got it? </p>
Most of the above parts are pretty self-explanatory. And again, the actual name is irrelevant, but in the long run, itll make your life easier if you use descriptive names. After all, header pretty much says it all, whereas you might not remember exactly which part <div id=style1> refers to, when you get back to your webpage at a later point. Or after lunch. The only division I used that might require a bit more explanation is wrapper. Technically, the body tag already is the main container of all your HTML, but the body tag encompasses every bit of real estate you see on your monitor. By throwing another wrapper into the body, it allows us to better define the actual content area. Its not mandatory, its not a you must but its just a very useful tool in creating almost any website I havent designed a site without it and probably never will. And now that the major parts of the page have been defined in the HTML, we can used those definition or divisions to create the connection between the HTML and the CSS.
body { background-color: #ffffff; color: #000000; } #wrapper { background-color: #FFDD33; width: 1050px; } #header {whatever;} #navigation {whatever;} #content {whatever;} #footer {whatever;}
url:ibtoffers.com seekers:www.ibtoffers@gmail.com
And now we use two simple lines in the CSS to move things to the middle: First, we need to give our wrapper a width:
#wrapper { width: 980px; }
How wide you set this wrapper, of course depends on your design. Instead of pixel, you could use %, or even em, but pixel is probably the better choice. And here comes the magic wand:
#wrapper { width: 980px; margin: 0 auto; }
It tells the browser to put a margin of zero to the top and bottom of the wrapper division (of course you can adjust that to your liking) and to automatically figure the right and left margins to center the wrapper (that needs to stay auto for the centering to work). P.S. In the olden aka pre-IE6 days, this needed to be done by adding a
body {text-align: center;}
But thank goodness, those days are gone. Its been ok to NOT support anything less than IE6 for a long time now, and even IE6 is about to be extinct.
Advanced Html :
Maybe this lesson should have been called: Developing an advanced understanding of HTML fundamentals. We are not trying to learn advanced tricks or new tags, we are doing something far more useful: Understanding the basics is what separates the pros from the amateurs.
Introduction
HTML is a relatively simple technology to learn, so easy in fact that once people get just a very basic understanding, they jump into building web pages without much thought about learning anything more about the fundamentals of HTML. As such, most web designers are not taking full advantage of HTML and CSS; they are wasting their time and money, generally making their lives more difficult.
Physical Tags
Physical tags on the other hand provide specific instructions on how to display the text they enclose. Examples of physical tags include: <b> : Makes the text bold. <big> : Makes the text usually one size bigger than whats around it. <font> : Used to apply a font-face (like Arial or Helvetica) and font-color. <i> : Makes text italic. Physical tags are more straightforward; <i> makes the text italic, <b> makes text bold and <font> is used to set the font face and color for the text. So why use one or the other? In a nutshell, physical tags were invented to add style to HTML pages because style sheets were not around, though the original intention of HTML was to not have physical tags. Why? Well physical tags are just messy, tedious, and are more trouble than theyre worth (for the most part). Rather than use physical tags to style your HTML pages, you should be using style sheets (also called Cascading Style Sheets or CSS).
url:ibtoffers.com seekers:www.ibtoffers@gmail.com