Pages

Thursday 26 December 2013

Html Chapter -1



HTML stands for Hyper Text Markup Language. HTML file is a text file containing small markup tags(<>).The markup tags tell the Web browser how to display the page. An HTML file must have an htm or htmlfile extension .An HTML file can be created using a simple text editor.

HTML  Tags:- HTML tags are used to mark-up HTML elements .HTML tags are surrounded by angular brackets.
There are two types of html tags:
1.     Container Tags:- These tags come in pairs like <html> and </html>. The first tag in a pair is the start tag,the second tag is the end tag. The text between the start and end tags is the element content.
2.     Empty Tags:- These tags come alone like <br />.These tags do not have end tag. We must add ending character (/) at the end of empty tags(not compulsory).
Html Tags are case insensitive, <HTML> means same as <html>.
Note:-By convention we use tags in lowercase.

Tag Attributes

Tags can have attributes. Attributes can provide additional information about the HTML elements on your page.
Attributes always come in name-value pairs like : name="value".
Attributes are always added to the start tag of an HTML element.
Ex: <tag  attribute_name=”value”> element content </tag>

Basic HTML Tags:-

(1). <html></html>:- This tag specifies start (<html>) and end (</html>) of our html document. All tags or element contents come between these tags.

(2). <head></head>:- This tag specifies the head of our html page. Head tag is loaded before the page is displayed.  JavaScript functions and Style Sheets comes under this tag.

(3). <body></body>:- This tag specifies body of a html page. All stuff of a web page comes under this tag.

(4). <title></title>:- This tag specifies title of a web page. Title displays on the title bar of our web page. This tag normally comes under  head tag.

<html>
                  <head>
                                    <title>My Page</title>
                  </head>
                  <body>
                                    Hello World! This is my first HTML Page.
                  </body>
</html>

Attributes of Body Tag:-

bgcolor :- This attribute is used to change background color of a web page.
                  Ex - <body bgcolor=”red”> </body>            or             <body bgcolor=”#ff0000”> </body>

background :- This attribute is used to set background image for an web page.
                  Ex - <body  background=”c:\sea.jpg”> </body>

bgproperties :- This attribute is used to specify the properties of background image such as scroll(default) and fixed.
                  Ex - <body  background=”c:\sea.jpg” bgproperties=”fixed”> </body>

text : This attribute is used to specify the color of the text for our web page.

link, alink, vlink :- These attributes are used to specify colors for links (link) , active links (alink), visited links (vlink).
                  ex - <body text=”blue” alink=”red” vlink=”yellow” link=”pink” >   </body>

Bold Text:-<b> </b> and <strong></strong> tags are used to make the text bold.
                  ex-           <body> we can make things <b> bold </b>   </body>
                  or             <body> we can make things <strong> bold </strong>   </body>

Italic Text:- <em></em> and <i> </i> tags are used to make the text in italic format.
                  ex -          something really <i> cool </i>.
                  or             something really <em> cool </em>.

Underline Text:-  <u> </u> tag is used to underline any text.
                  ex-           <u> This is important </u>.

Subscript, Superscript and StrikeThrough:- <sub> </sub>, <sup> </sup> and <strike> </strike>tags are used to make text as subscript, superscript and strikethrough respectively.
Example: H<sub>2</sub>O                       H2O
                    
X<sup>2</sup>                           X2 
                     <strike> Hello </strike>                Hello     

Nesting of html tags: We should nest html tags in last in first out (LIFO) format.
                  ex – This is <b> <i> Bold and Italic </b> </i>.

<this> <that> </this> </that>                (bad)
<this><that> </that> </this>                 (good).

Font : We can change the font using <font></font> tag.
attributes:
(a). size :- This attribute specifies size of our font. In HTML 7 font sizes are available (1-7). Default font size is 3.
(b). face :- This attribute specifies name of the font. Some common fonts are Arial, Arial Black, Courier new, Times New Roman, Verdana.
Ex: <font face=”Arial” size=”5”> My Font </font>
(c). color :- This attribute is used to specify the color of font.
Ex: <font color=”blue” size=”5”> My Font </font>

No comments:

Post a Comment