Web DesignTemplatesThe three ways you can build a web page:
Ok, now that we know the advantages of hand-coding web pages, let's jump into just the bare minimum of theory, then we will build our first web page! What are HTML tags?HTML tags are specifically formatted text that creates 'markers' for web browser to read and interpret. These 'markers' tell the web browser what and how to display things on the web page. Tags are placed in and around text and images (text and images are some of the 'things') that your want to have appear in your web pages. HTML has a whole bunch of tags (just like the alphabet has a whole bunch of letters) that the web designer can use to build web pages. As mentioned above, tags have a specific structure so that when the browser is reading an HTML page, it knows the tags from the normal text. Tags are typically words or abbreviations of words placed between angled brackets. So for example: to make text bold, HTML has the 'bold' tag that looks like this: <b>This text is bold</b> Another commonly used tag is the paragraph tag: Tag DiagramYou may have noticed that HTML tags come in pairs; HTML has both an opening tag (<tag name>) and a closing tag (</tag name>). The only difference between the opening and closing tags is that the closing tag contains an extra forward slash. ![]() Some EXAMPLE HTML tags that might make things clearer:
I hope you can see the pattern in the list above. HTML tags are not just for placing and formatting text, HTML tags can be used to include other things like: animation, video, Flash, audio, and even multimedia programs. Comparing HTML code and the web page it createsLet's start with a very simple web page to make it as easy for you to understand. First lets look at the final page: sample web page Now that we've seen what the page looks like, let's look at the HTML code used to create the page. What you should do now is take a little time and compare the HTML page and the page with the code that is used to create the page. Notice where the tags are and what they are doing. The structure of an HTML pageAn HTML page is divided into two major sections:
You will notice that both the head and the body sections of a web site are marked in the HTML page with their respective tags: (<head> </head>) and (<body> </body>). If the body tag creates the body of an HTML page, and the head tag creates the head of an HTML page, how do you create an HTML page itself? You guessed it, use the HTML tags: <html> </html> The 'mother of all tags' is the HTML tag, and like all tags it must have a start tag (<html>) and an end tag (</html>). The difference between the start and end tags is the forward slash (/), but you already knew that.
Every web page MUST begin and end with the HTML tag, otherwise the web browser (programs like Internet Explorer) will not be able to display the page. You also have to have the head tags and the body tags. All the other tags are optional.
So the bare-bones HTML page must have these tags and in this order: BUILDING A WEBSITEIntroduction: What is a website?A website is just a bunch of web pages connected together through something called links. In HTML there is a special tag called (you guessed it!) the 'link' tag, and it looks like this in its most basic form: Absolute vs. Relative URLTo link pages in your web site from one page to the next you have a choice of using one of two types of addresses: absolute addresses (complete) and relative addresses (partial). Before I go on, URL is a nerd's way of saying 'address'. An absolute URL is the complete address of a page that can be found from any other location on the Internet. So let's say you have a page called contact.html on the root of your web site who's domain name is www.myStore.com . In this case, the absolute URL of the contact.html page would be: 'http://www.myStore.com/contact.html' Ok, now I know I lost a few people because I used a word that I did not explain: 'root'. When geeks talk about the root of a web site, they are taking about the base of the web site, the starting level. The files (pages, images, etc.) that make up your web site are organized in folders just like any other files that you store on your home computer. Your host will give you a space/directory on their server for you to place all your website's files. This space/folder assigned to you will be the 'root' of your web site. This means that as far as the Internet is concerned, anything (html files, images, other folders, etc.) in this folder is directly accessible by your domain name plus the name of the item. Huh! Even I'm a little confused! Perhaps a little example will explain this better: Let's say that on the root level of your website, you had these HTML files: index.html and contact.html And in a folder called 'products', you placed whole bunch of other pages with one called 'bookcases.html'. You decided to put all your 'product' HTML pages into a 'products' folder to keep the web site more organized - a smart thing to do! Can you guess what the absolute URL would be for the web page 'bookcases.html'? For the domain name: 'www.myStore.com' it would be: http://www.myStore.com/products/bookcases.html. Just think about it a little and hopefully it will sink in! If it doesn't right away, don't worry, it will come. ![]() Relative URLA relative URL is a partial address that is relative to the page where you placed your link. So if you were linking from the index.html page of this web site to the bookcases.html page your relative URL (address) would be:
/products/bookcases.html. CSSWhat is CSS?CSS is the acronym for: ‘Cascading Style Sheets’. CSS is an extension to basic HTML that allows you to style your web pages. An example of a style change would be to make words bold. In standard HTML you would use the <b> tag like so:
<b>make me bold</b>.
This works fine and there is nothing wrong with it per se, except that now if you wanted to, say, change all your text that you initially made bold to underlined, you would have to go to every spot in every page and change the tag.
Another disadvantage can be found in this example: say you wanted to make the above text bold, make the font style Verdana and change its color to red you would need a lot of code wrapped around the text:
<font color="#FF0000" face="Verdana, Arial, Helvetica, sans-serif"><strong>This is text</strong></font> In the above example we include the style sheet code inline, or in other words, in the page. This is fine for smaller projects or in situations where the styles you're defining will only be used in a single page. There are many times when you will be applying your styles to many pages and it would be a hassle to have to copy and paste you CSS code into each page. Besides, the fact that you will be cluttering up each page with the same CSS code, you also find yourself having to edit each of these pages if you want to make a style change. Like with JavaScript, you can define/create your CSS style in a separate file and then link it to the page you want to apply the code to:
<link href="myFirstStyleSheet.css" rel="stylesheet" type="text/css"> You DON'T add these tags in the CSS document/page itself as you would if you embedded the CSS code in your HTML: In the above example I have created a series of CSS classes that can be applied to any HTML tag like so: You will notice that in the above example I applied a CSS style to an <h2> tag. This tag sets the size of the text that it wraps to a size that is preset in the browser (ex: 10 pixels). When you apply a CSS class to it, the CSS code overrides the default size that you would normally get with an <h2> tag in favor of the size specified in the CSS class. So now you can see that CSS can override default HTML tag behavior!
In the above examples, I have CSS code where I define my CSS classes and then ‘apply’ them to various elements in the page. Another way to apply CSS is to globally redefine an HTML tag to look a certain way: A few things to explain about the above:
I typically use hex color since I am familiar with them or I just use named colors. So the last example can be rewritten like so: div { So instead of ‘rgb(204,204,255)’ , I just specified ‘green’.
By using RGB (RGB is the acronym for: ‘Red Green Blue’) and Hex color, you can really get the exact color you want easily when you know your codes. Luckily many programs (like Dreamweaver) provide easy to use color pickers for you so you don’t need to know the values for the code.
In this last example I will show you the ‘super cool’ CSS code that allows you to create link roll-over effects without images: The above CSS will cause your link to change color when someone hovers their mouse pointer over it, instant rollovers with no images! One important note with the above code is that it is important that the style declarations be in the right order: "link-visited-hover-active", otherwise it may break it in some browsers. CSS is very powerful and allows you to do things that you can’t do with standard HTML. It is supported nicely now in all the modern browsers and is a must learn tool for web designers. The above examples are just a small sample of what you can do with CSS, but it should be more than enough for you to start styling your pages nicely. Like with many technologies, CSS has a lot of capability that most people will not need to use often if at all. Don’t get caught in the trap of thinking that if there is some functionality/feature available, that you have to use it. Advanced HTMLMaybe 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. IntroductionHTML 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. The differences between logical and physical tags is one of the key fundamental concepts in HTML that, when understood, can have a huge impact on a web designer's way of doing things. Logical inline tags vs. Physical inline tagsLogical TagsIn HTML there are both logical tags and physical tags. Logical tags are designed to describe (to the browser) the enclosed text's meaning. An example of a logical tag is the <strong></strong> tag. By placing text in between these tags you are telling the browser that the text has some greater importance. By default all browsers make the text appear bold when in between the <strong>and</strong> tags, but the point to take away from this is that the strong tag implies the importance of that text. This has impact with search engines like Google who look for such tags to help figure out what the page is about. There are many logical tags and they include:
Logical tags, as mentioned above, have default ways in which browsers (like IE or Opera) render them. But it is understood that CSS should be used to give them their style, or in other words their 'look'. Physical TagsPhysical tags on the other hand provide specific instructions on how to display the text they enclose. Examples of physical tags include:
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 they're 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). Block level vs. Inline tagsWhat is the point of 'inline' in the description of the tag categories? In HTML, tags are either 'inline' or 'block-level' elements. Block level HTML elementsBlock-level elements exist in their own virtual 'box' and are always followed by a line break (like hitting the 'enter' key after typing in some text). In other words, a block-level element breaks the flow of text and other elements to create a virtual box around itself. Inline HTML elementsInline tags (elements) become a part of the 'flow' of text in which they are inserted and have no 'box' around them and don't have the line break, either. An example of a block tag is a <p> tag (paragraph) and an example of an inline tag is the <b> (bold) tag. Try the tags out and you'll see what happens to your page when you use <p> tags and <b> tags; all will be made clear once you see it for yourself. ![]() So who cares? You should care! Once you understand the differences (it's really not that hard if you just give yourself a chance) and once you understand that you can use CSS to change elements from being block tags to inline tags and vice versa, you will discover tremendous power in your ability to layout your pages. Source: LearnTheNet.com |