HTML
html: Html is a publishing language that all computers understand. Html make skeletal of any website.
Full form of html: hyper text mark-up language
Extension: Extension of html is .htm or .html
Source code: The source code of a web page is constructed using a series of standardized keywords and abbreviations known as html.
Element: Each keyword or abbreviation in html is known as element. Each html element is like a command, which identifies what part of web page to address.
Tag: Element is enclosed in angle brackets <>. Angle brackets and html element assembly is known as a tag.
Version of HTML
Tags:
Structure of html tag: <element-name>
e.g.<html> </html>, <img>, <br>
Parts of tag: Majority of tags have two parts.
(1) Opening or starting tag (2) Closing or end tag
Structure of opening tag: <element-name>
Structure of closing tag: </element-name>
#Closing tag differs by incorporating a forward slash (/).
Angle brackets <> : The angle brackets enclosing html elements keep them hidden behind the scenes of a web page. The elements do not appear on the web page itself. But rather they only act as a means to instruct the web browser how to display that which appears between the start tag and the end tag.
Types of tag:
Category #1
-
- Single tag / Open tag (no area cover)
e.g. <br>, <hr>
-
- Pair tag / Close tag (Area cover)
e.g. <p> </p>, <div> </div>
Category #2
-
- Basic Tags
e.g. <!DOCTYPE>, <html> </html>,<head> </head>, <body> <body>, <title> </title>
-
- Block Tags (Cover whole row/line area)
e.g. <p> </p>, <div> </div>, <ol> </ol>, <ul> <ul>, <li> <li>
-
- Inline Tags (no cover whole row/line area)
e.g. <span> </span>, <strong> </strong>
Details:
Block Tags:
Use of Block Elements: When writing up html source code, all line breaks created by pressing the ‘Enter’ key will not register as line breaks and will be ignored by the web browser on the web page. In order to create line breaks and format visible text into paragraphs, you will use block or block-level element
Difference between block elements and inline elements: The main difference between block elements and inline elements is that the end tag of a block element forces a line break in the visible text.
Attribute: Sub-command along with html element known as “attribute”, this supply extra information to the browser. Attribute is always put between quotation marks.
Structure of attribute: <tag attribute=”value”> …… </tag>
e.g. <p align=”center”> Hello word </p>
# here p called element, align called attribute center called value.
All contents of a web page written between <html> </html> tag.
Essential Web Page Structure: A web page created using html has an essential structure
Structure #1
Structure #2
Exercise
Write your first web page
1. Open notepad
2. Write following code
3. Save As file with .html extension. (like index.html)
4. Open file with chrome.
Result#There are mainly two tags under <html> </html> tag.
1. <head> </head>
2. <body> </body>
StructureThere are Tags under <head> </head> tag.
-
- <title> </title>
- <style> </style>
- <meta>
- <link>
- <base>
There are Tags under <body> </body> tag.
-
- <h1> </h1>
- <p> </p>
- <div> </div>
- <table> </table>
- <form> </form>
Common tag: <script> </script> (script tag used under both head and body tag)
HTML Tags (Details)
Title: Adding a title to a web page
(Title: A title that appears in the title bar that runs across the very top of the web page)
<title> </title>
Example ResultBody: Adding content on a web page.
<body> </body>
Example Result Hello world.Heading and Subheading: (If would you like to format the text into title and subtitles on your web page)
<h1> … <h1>
<h2> … <h2>
<h3> … <h3>
<h4> … <h4>
<h5> … <h5>
<h6> … <h6>
Example ResultHeading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Miscellaneous tags
Line Break: Forcing a Line Break
<br>
Details: The all-purpose br element forces a line break anytime you want without having to place the text within a block level element.
# br element known as ’empty’ element
Example Result This is the first line.Lorem ipsum dolor sit amet consectetur adipisicing elit.
Expedita sit a consequuntur optio repudiandae magnam impedit quia. Maiores, illo saepe.
Font: Font tag have many attributes. Without attribute font tag have no effect.
<font> </font>
Font face: You can designate what typeface a browser will use to display the text on your web page.
<font face=””> </font>
Example Result This is ArialOther Font Styles
bold
<b> </b>
Example Result Hello worlditalic
<i> </i>
Example Result Hello worldUnderline
<u> </u>
Example Result Hello worldStrike-through
<s> </s>
Example ResultMaking Paragraphs
p (paragraph): Render text into paragraphs with a blank line in between each.
<p> </p>
Details: Creating paragraphs using html is accomplished by placing the text which rendered as a paragraph in between the p p tag. The end /p tag terminates the paragraph while a new start p tag beings a new paragraph.
Example ResultLorem ipsum dolor, sit amet consectetur adipisicing elit. In ea, nisi veniam cum natus repellendus nam distinctio aspernatur accusantium at.
Graphics
Image: Image tag have many attributes. Without any attributes img tag have no effect.
<img>
Structure<img src=”graphic file name”>
or<img src=”filename.ext”>
# Where filename.ext is the full name (including file extention) of the graphic or image you wish to display
File formats: Web graphics are generally served up in one of two formats: GIF or JPEG. Hence GIFs carry the .gif file extension and JPEGs carry the .jpeg or .jpg file extension.
Example ResultFile Address
Relative file address: When html file and graphics file is in same folder, we use only file name with extention
ResultAbsolute file address: When we write full path of graphics
ResultCreating Hyperlinks
Anchor tag: The most powerful and widely used of all html elements.
<a> </a>
Structure<a href=”valid web address”> … </a>
# Where valid web addresss equals any existing URL (Uniform Resource Locator)
Example Result Welcome to Shahid StudyHorizontal rules: Horizontal line
<hr>
Example ResultMaking lists
Unordered list
Example ResultList of some colors
- Red
- Green
Ordered list
Example ResultList of some colors
- Red
- Green
Creating Table
tr: (table row) tr create table row
td: (table data) td create table column
Structure
Example Resultrow1 column1 | row1 column2 |
row2 column1 | row2 column2 |
table border
Example Resultrow1 column1 | row1 column2 |
row2 column1 | row2 column2 |
Forms
Example Resultmarquee
Example Result Welcomesymbol & character
Character | Name | code |
---|---|---|
< | less than | & |
> | greater than | & |
“ | quotation mark | & |
& | ampersand | & |
non-breakable space | & | |
| | broken vertical bar | & |
© | COPYRIGHT SIGN | & |
® | REGISTERED SIGN | & |
™ | TRADEMARK | & |
← | LEFTWARDS ARROW | & |
↑ | UPWARDS ARROW | & |
→ | RIGHTWARDS ARROW | & |
↓ | DOWNWARDS ARROW | & |
Color code
Color-name | hexadecimal color code | color |
---|---|---|
Black | #000000 | |
Silver | #c0c0c0 | |
Gray | #808080 | |
White | #ffffff | |
Maroon | #800000 | |
Red | #ff0000 | |
Purple | #800080 | |
Fuchsia | #ff00ff | |
Green | #008000 | |
Lime | #00ff00 | |
Olive | #808000 | |
Yellow | #ffff00 | |
Navy | #000080 | |
Blue | #0000ff | |
Teal | #008080 | |
Aqua | #00ffff |