Академический Документы
Профессиональный Документы
Культура Документы
HTML Overview
What is HTML?
• the "mother tongue" of your browser
• invented in 1990 by a scientist called Tim Berners-Lee
• a language, which makes it possible to present information on the Internet
• What you see when you view a page on the Internet is your browser's interpretation of HTML.
• To see the HTML code of a page on the Internet, simply click "View" in the top menu of your browser and choose "Source".
What can I use HTML for?
• HTML is used to make websites. It is as simple as that!
• HTML is an abbreviation of "HyperText Mark-up Language" - which is already more than you need to know at this stage.
However, for the sake of good order, let us explain in greater detail.
– Hyper is the opposite of linear.
– Text is self-explanatory.
– Mark-up is what you do with the text. You are marking up the text the same way you do in a text editing program
with headings, bullets and bold text and so on.
– Language is what HTML is. It uses many English words.
What is needed?
• a "browser". A browser is the program that makes it possible to browse and open websites.
• a simple text editor
• If you are using Windows you can use Notepad, which is usually found in the start menu under Programs in Accessories
Structure of HTML Document
• Open Structure.html
• The <!DOCTYPE> declaration helps the browser to display a web page correctly.
HTML Tags
HTML markup tags are usually called HTML tags.
• HTML tags are keywords (tag names) surrounded by angle brackets like <html>
• HTML tags normally come in pairs like <p> and </p>
• The first tag in a pair is the start tag, the second tag is the end tag
• The end tag is written like the start tag, with a slash before the tag name
• Start and end tags are also called opening tags and closing tags
HTML Elements
• It has a begin tag, end tag and has content
– ex. Title
• An HTML element starts with a start tag / opening tag
• An HTML element ends with an end tag / closing tag
• The element content is everything between the start and the end tag
• Some HTML elements have empty content
• Empty elements are closed in the start tag
• Most HTML elements can have attributes
HTML Attributes
Attributes provide additional information about HTML elements.
• HTML elements can have attributes
• Attributes provide additional information about an element
• Attributes are always specified in the start tag
• Attributes come in name/value pairs like: name="value“
ex. <a href="http://www.w3schools.com">This is a link</a>
Attribute Values
• Attribute values should always be enclosed in quotes.
• Double style quotes are the most common, but single style quotes are also allowed.
• Attribute names and attribute values are case-insensitive.
• However, the World Wide Web Consortium (W3C) recommends lowercase attributes/attribute values in their HTML 4
recommendation.
Some attributes that can be used on any HTML element
Obsolete tags Obsolete Attributes
<div> elements
• The HTML <div> element is a block level element that can be used as a container for grouping other HTML elements.
• The <div> element has no special meaning. Except that, because it is a block level element, the browser will display a line
break before and after it.
• When used together with CSS, the <div> element can be used to set style attributes to large blocks of content.
• Another common use of the <div> element, is for document layout. It replaces the "old way" of defining layout using
tables. Using <table> elements for layout is not the correct use of <table>. The purpose of the <table> element is to display
tabular data.
<span> elements
• The HTML <span> element is an inline element that can be used as a container for text.
• The <span> element has no special meaning.
• When used together with CSS, the <span> element can be used to set style attributes to parts of the text.
Character Sets
• To display an HTML page correctly, the browser must know what character set (character encoding) to use.
• For HTML5, the default character encoding is UTF-8.
• The character encoding for the early web was ASCII.
• from HTML 2.0 to HTML 4.01, ISO-8859-1 was considered the standard.
HTML_Basics2.Float And Links
Floats
• With CSS float, an element can be pushed to the left or right, allowing other elements to wrap around it.
• Float is very often used for images, but it is also useful when working with layouts.
How Elements Float
• Elements are floated horizontally, this means that an element can only be floated left or right, not up or down.
• A floated element will move as far to the left or right as it can. Usually this means all the way to the left or right of the
containing element.
• The elements after the floating element will flow around it.
• The elements before the floating element will not be affected.
• If an image is floated to the right, a following text flows around it, to the left.
Floating Elements Next to Each Other
• If you place several floating elements after each other, they will float next to each other if there is room.
• Here we have made an image gallery using the float property.
Turning off Float - Using Clear
• Elements after the floating element will flow around it. To avoid this, use the clear property.
• The clear property specifies which sides of an element other floating elements are not allowed.
• Add a text line into the image gallery, using the clear property.
HTML Hyperlinks
• The HTML <a> tag defines a hyperlink.
• A hyperlink (or link) is a word, group of words, or image that you can click on to jump to another document.
• When you move the cursor over a link in a Web page, the arrow will turn into a little hand.
• The most important attribute of the <a> element is the href attribute, which indicates the link's destination.
• By default, links will appear as follows in all browsers:
– An unvisited link is underlined and blue
– A visited link is underlined and purple
– An active link is underlined and red
The target Attribute
• The target attribute specifies where to open the linked document.
The id Attribute
• The id attribute can be used to create a bookmark inside an HTML document.
• An anchor with an id inside an HTML document:
– <a id="tips">Useful Tips Section</a>
• Create a link to the "Useful Tips Section" inside the same document:
– <a href="#tips">Visit the Useful Tips Section</a>
• Or, create a link to the "Useful Tips Section" from another page:
– <a href="http://www.w3schools.com/html_links.htm#tips">
Visit the Useful Tips Section</a>
Absolute vs relative paths
• Relative Paths
– index.html
– /graphics/image.png
– /help/articles/how-do-i-set-up-a-webpage.html
• Absolute Paths
– http://www.mysite.com
– http://www.mysite.com/graphics/image.png
– http://www.mysite.com/help/articles/how-do-i-set-up-a-webpage.html