Basic HTML Tags
The most important tags in HTML are tags that define headings, paragraphs and line breaks.Headings
Headings are defined with the <h1> to <h6> tags. <h1> defines the largest heading. <h6> defines the smallest heading.<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
<h4>This is a heading</h4>
<h5>This is a heading</h5>
<h6>This is a heading</h6>
HTML automatically adds an extra blank line before and after a heading.
Paragraphs
Paragraphs are defined with the <p> tag.<p>This is a paragraph</p>
<p>This is another paragraph</p>
HTML automatically adds an extra blank line before and after a paragraph.
Line Breaks
The <br> tag is used when you want to end a line, but don't want to start a new paragraph. The <br> tag forces a line break wherever you place it.<p>This <br> is a para<br>graph with line breaks</p>
The <br> tag is an empty tag. It has no closing tag.
Comments in HTML
The comment tag is used to insert a comment in the HTML source code. A comment will be ignored by the browser. You can use comments to explain your code, which can help you when you edit the source code at a later date.
<!-- This is a comment -->
Note that you need an exclamation point after the opening bracket, but not before the closing bracket.
Basic HTML Tags
Tag Description
- <html> Defines an HTML document
- <body> Defines the document's body
- <h1> to <h6> Defines header 1 to header 6
- <p> Defines a paragraph
- <br> Inserts a single line break
- <hr> Defines a horizontal rule
- <!--> Defines a comment
HTML Text Formatting
HTML defines a lot of elements for formatting output, like bold or italic text.
How to View HTML Source
HTML defines a lot of elements for formatting output, like bold or italic text.
How to View HTML Source
Have you ever seen a Web page and wondered "How do they do that?"
To find out, simply click on the VIEW option in your browsers toolbar and select SOURCE or PAGE SOURCE. This will open a window that shows you the actual HTML of the page.
Text Formating Tags
Tags Description
- <b> Defines bold text
- <big> Defines big text
- <em> Defines emphasized text
- <i> Defines italic text
- <small> Defines small text
- <strong> Defines strong text
- <sub> Defines subscripted text
- <sup> Defines superscripted text
- <ins> Defines inserted text
- <del> Defines deleted text
- <s> Deprecated. Use <del> instead
- <strike> Deprecated. Use <del> instead
- <u> Deprecated. Use styles instead
HTML Character Entities
Some characters like the < character, have a special meaning in HTML, and therefore cannot be used in the text.
To display a less than sign (<) in HTML, we have to use a character entity.
Character Entities
Some characters have a special meaning in HTML, like the less-than sign (<) that defines the start of an HTML tag. If we want the browser to actually display these characters we must insert character entities in the HTML source.
A character entity has three parts: an ampersand (&), an entity name or a # and an entity number, and finally a semicolon (;).
To display a less than sign in an HTML document we must write: < or <
The advantage of using a name instead of a number is that a name is easier to remember. The disadvantage is that not all browsers support the newest entity names, while the support for entity numbers is very good in almost all browsers.
Note that the entities are case sensitive.
Non-breaking Space
The most common character entity in HTML is the non-breaking space.
Normally HTML will truncate spaces in your text. If you write 10 spaces in your text HTML will remove 9 of them. To add spaces to your text, use the character entity.
The Most Common Character Entities:
Result Description Entity Name Entity Number
non-breaking space  
< less than < <
> greater than > >
& ampersand & &
" quotation mark " "
' apostrophe ' '
SOME OTHER COMMONLY USED CHARACTER ENTITIES
Result Description Entity Name Entity Number
¢ cent ¢ ¢
£ pound £ £
§ section § §
© copyright © ©
® registered trademark ® ®
× multiplication × ×
÷ division ÷ ÷
¥ yen ¥ ¥
£ pound £ £
§ section § §
© copyright © ©
® registered trademark ® ®
× multiplication × ×
÷ division ÷ ÷
¥ yen ¥ ¥
The Anchor Tag and the Href Attribute
HTML uses the <a> (anchor) tag to create a link to another document.
An anchor can point to any resource on the Web: an HTML page, an image, a sound file, a movie, etc.
The syntax of creating an anchor:
<a href="url">Text to be displayed</a>
The <a> tag is used to create an anchor to link from, the href attribute is used to address the document to link to, and the words between the open and close of the anchor tag will be displayed as a hyperlink.
This anchor defines a link to W3Schools:
<a href="http://www.w3schools.com/">Visit W3Schools!</a>
The line above will look like this in a browser:
Visit W3Schools!

No comments:
Post a Comment