Sunday 15 October 2017

HTML remains for Hypertext Markup Language, and it is the most generally utilized dialect to compose Web Pages.


  • Hypertext alludes to the path in which Web pages (HTML records) are connected together. Along these lines, the connection accessible on a website page is called Hypertext. 
  • As its name recommends, HTML is a Markup Language which implies you utilize HTML to just "increase" a content archive with labels that advise a Web program how to structure it to show. 


Initially, HTML was produced with the goal of characterizing the structure of archives like headings, passages, records, et cetera to encourage the sharing of logical data between analysts.

Presently, HTML is by and large generally used to arrange site pages with the assistance of various labels accessible in HTML dialect.

Essential HTML Document 

In its most straightforward frame, following is a case of a HTML report −

<!DOCTYPE html>
<html>

   <head>
      <title>This is document title</title>
   </head>
 
   <body>
      <h1>This is a heading</h1>
      <p>Document content goes here.....</p>
   </body>
 
</html>

It is possible that you can utilize Try it choice accessible at the upper right corner of the code box to check the consequence of this HTML code, or we should spare it in a HTML record test.htm utilizing your most loved content manager. At long last open it utilizing a web program like Internet Explorer or Google Chrome, or Firefox and so forth. It must demonstrate the accompanying yield −

HTML Tags 

As told before, HTML is a markup dialect and makes utilization of different labels to organize the substance. These labels are encased inside edge supports <Tag Name>. But few labels, the vast majority of the labels have their comparing shutting labels. For instance, <html> has its end tag </html> and <body> tag has its end tag </body> tag and so on.

Above case of HTML report utilizes the accompanying labels −

Sr.NoTag & Description
1<!DOCTYPE...>
This tag defines the document type and HTML version.
2<html>
This tag encloses the complete HTML document and mainly comprises of document header which is represented by <head>...</head> and document body which is represented by <body>...</body> tags.
3<head>
This tag represents the document's header which can keep other HTML tags like <title>, <link> etc.
4<title>
The <title> tag is used inside the <head> tag to mention the document title.
5<body>
This tag represents the document's body which keeps other HTML tags like <h1>, <div>, <p> etc.
6<h1>
This tag represents the heading.
7<p>
This tag represents a paragraph.

To learn HTML, you should ponder different labels and see how they act, while arranging a literary record. Learning HTML is straightforward as clients need to take in the utilization of various labels keeping in mind the end goal to organize the content or pictures to make an excellent website page.

Internet Consortium (W3C) prescribes to utilize lowercase labels beginning from HTML 5.

HTML Document Structure 

An ordinary HTML archive will have the accompanying structure −

<html>
   
   <head>
      Document header related tags
   </head>
   
   <body>
      Document body related tags
   </body>
   
</html>
We will ponder all the header and body labels in resulting sections, however until further notice how about we see what is record affirmation tag.

The <!DOCTYPE> Declaration 

The <!DOCTYPE> affirmation tag is utilized by the web program to comprehend the adaptation of the HTML utilized as a part of the report. Current adaptation of HTML is 5 and it makes utilization of the accompanying announcement −

<!DOCTYPE html>
There are numerous other affirmation sorts which can be utilized as a part of HTML archive contingent upon what variant of HTML is being utilized. We will see more points of interest on this while talking about <!DOCTYPE...> follow alongside other HTML labels.

Any archive begins with a heading. You can utilize distinctive sizes for your headings. HTML additionally has six levels of headings, which utilize the components <h1>, <h2>, <h3>, <h4>, <h5>, and <h6>. While showing any heading, program includes one line earlier and one line after that heading.

Case 

<!DOCTYPE html>
<html>

   <head>
      <title>Heading Example</title>
   </head>
 
   <body>
      <h1>This is heading 1</h1>
      <h2>This is heading 2</h2>
      <h3>This is heading 3</h3>
      <h4>This is heading 4</h4>
      <h5>This is heading 5</h5>
      <h6>This is heading 6</h6>
   </body>
 
</html>
Section Tag 

The <p> label offers an approach to structure your content into various sections. Each section of content ought to go in the middle of an opening <p> and an end </p> tag as appeared beneath in the illustration −

Illustration 

<!DOCTYPE html>
<html>

   <head>
      <title>Paragraph Example</title>
   </head>
 
   <body>
      <p>Here is a first paragraph of text.</p>
      <p>Here is a second paragraph of text.</p>
      <p>Here is a third paragraph of text.</p>
   </body>
 
</html>
Line Break Tag 

At whatever point you utilize the <br/> component, anything tailing it begins from the following line. This tag is a case of a vacant component, where you needn't bother with opening and shutting labels, as there is nothing to go in the middle of them.

The <br/> tag has a space between the characters br and the forward slice. On the off chance that you preclude this space, more seasoned programs will experience difficulty rendering the line break, while on the off chance that you miss the forward slice character and simply utilize <br> it isn't legitimate in XHTML.

Illustration 

<!DOCTYPE html>
<html>

   <head>
      <title>Line Break  Example</title>
   </head>
 
   <body>
      <p>Hello<br />
         You delivered your assignment ontime.<br />
         Thanks<br />
         Mahnaz</p>
   </body>
 
</html>

Focusing Content 

You can utilize <center> tag to put any substance in the focal point of the page or any table cell.

Case 

<!DOCTYPE html>
<html>

   <head>
      <title>Centring Content Example</title>
   </head>
 
   <body>
      <p>This text is not in the center.</p>
      
      <center>
         <p>This text is in the center.</p>
      </center>
   </body>
 
</html>

Level Lines 

Level lines are utilized to outwardly separation areas of an archive. The <hr> tag makes a line from the present position in the archive to the correct edge and breaks the line likewise.

For instance, you might need to give a line between two passages as in the given case beneath −

Illustration 

<!DOCTYPE html>
<html>

   <head>
      <title>Horizontal Line Example</title>
   </head>
 
   <body>
      <p>This is paragraph one and should be on top</p>
      <hr />
      <p>This is paragraph two and should be at bottom</p>
   </body>
 
</html>

Again <hr/> tag is a case of the void component, where you needn't bother with opening and shutting labels, as there is nothing to go in the middle of them.

The <hr/> component has a space between the characters hr and the forward slice. On the off chance that you preclude this space, more established programs will experience difficulty rendering the flat line, while on the off chance that you miss the forward cut character and simply utilize <hr> it isn't substantial in XHTML

Protect Formatting 

Here and there, you need your content to take after the correct arrangement of how it is composed in the HTML report. In these cases, you can utilize the preformatted tag <pre>.

Any content between the opening <pre> tag and the end </pre> tag will protect the organizing of the source report.

Illustration 

<!DOCTYPE html>
<html>

   <head>
      <title>Preserve Formatting Example</title>
   </head>
 
   <body>
      <pre>
         function testFunction( strText ){
            alert (strText)
         }
      </pre>
   </body>
 
</html>

Have a go at utilizing a similar code without keeping it inside <pre>...</pre> labels

Nonbreaking Spaces 

Assume you need to utilize the expression "12 Angry Men." Here, you would not need a program to part the "12, Angry" and "Men" crosswise over two lines −

A case of this strategy shows up in the film "12 Angry Men."

In cases, where you don't need the customer program to break content, you should utilize a nonbreaking space element &nbsp; rather than an ordinary space. For instance, when coding the "12 Angry Men" in a section, you should utilize something like the accompanying code −

Illustration 

<!DOCTYPE html>
<html>

   <head>
      <title>Preserve Formatting Example</title>
   </head>
 
   <body>
      <pre>
         function testFunction( strText ){
            alert (strText)
         }
      </pre>
   </body>
 
</html>
A HTML component is characterized by a beginning tag. On the off chance that the component contains other substance, it closes with an end tag, where the component name is gone before by a forward slice as appeared underneath with few labels −

Start TagContentEnd Tag
<p>This is paragraph content.</p>
<h1>This is heading content.</h1>
<div>This is division content.</div>
<br />
So here <p>....</p> is a HTML component, <h1>...</h1> is another HTML component. There are some HTML components which don't should be shut, for example, <img.../>, <hr/> and <br/> components. These are known as void components.

HTML archives comprises of a tree of these components and they determine how HTML records ought to be manufactured, and what sort of substance ought to be put in what part of a HTML report.

HTML Tag versus Component 

A HTML component is characterized by a beginning tag. On the off chance that the component contains other substance, it closes with an end tag.

For instance, <p> is beginning tag of a passage and </p> is shutting tag of a similar section yet <p>This is paragraph</p> is a passage component.

Settled HTML Elements 

It is especially permitted to keep one HTML component inside another HTML component −

Illustration 

<!DOCTYPE html>
<html>

   <head>
      <title>Nested Elements Example</title>
   </head>
 
   <body>
      <h1>This is <i>italic</i> heading</h1>
      <p>This is <u>underlined</u> paragraph</p>
   </body>
 
</html>
We have seen few HTML labels and their utilization like heading labels <h1>, <h2>, passage tag <p> and different labels. We utilized them so far in their least complex shape, yet the vast majority of the HTML labels can likewise have characteristics, which are additional bits of data.

An ascribe is utilized to characterize the attributes of a HTML component and is put inside the component's opening tag. All properties are comprised of two sections − a name and an esteem


  • The name is the property you need to set. For instance, the passage <p> component in the case conveys a trait whose name is adjust, which you can use to show the arrangement of section on the page. 
  • The esteem is the thing that you need the estimation of the property to be set and dependably put inside citations. The beneath case indicates three conceivable estimations of adjust property: left, focus and right. 


Quality names and characteristic esteems are case-unfeeling. Be that as it may, the World Wide Web Consortium (W3C) suggests lowercase characteristics/trait esteems in their HTML 5 proposal.

Case 

<!DOCTYPE html> 
<html>
 
   <head> 
      <title>Align Attribute  Example</title> 
   </head>
 
   <body> 
      <p align = "left">This is left aligned</p> 
      <p align = "center">This is center aligned</p> 
      <p align = "right">This is right aligned</p> 
   </body>
 
</html>
Center Attributes 

The four center properties that can be utilized on the dominant part of HTML components (despite the fact that not all) are −

  • Id 
  • Title 
  • Class 
  • Style 

The Id Attribute 

The id quality of a HTML tag can be utilized to exceptionally distinguish any component inside a HTML page. There are two essential reasons that you might need to utilize an id quality on a component −


  • In the event that a component conveys an id trait as an extraordinary identifier, it is conceivable to distinguish recently that component and its substance. 
  • In the event that you have two components of a similar name inside a Web page (or template), you can utilize the id ascribe to recognize components that have a similar name. 


We will talk about template in discrete instructional exercise. For the present, how about we utilize the id credit to recognize two section components as demonstrated as follows.

Illustration 

<p id = "html">This para explains what is HTML</p>
<p id = "css">This para explains what is Cascading Style Sheet</p>

The title Attribute 

The title property gives a proposed title for the component. They linguistic structure for the title quality is comparative as clarified for id trait −

The conduct of this characteristic will rely on the component that conveys it, in spite of the fact that it is frequently shown as a tooltip when cursor comes over the component or while the component is stacking.

Case 

<!DOCTYPE html>
<html>

   <head>
      <title>The title Attribute Example</title>
   </head>
 
   <body>
      <h3 title = "Hello HTML!">Titled Heading Tag Example</h3>
   </body>
 
</html>
Presently attempt to bring your cursor over "Titled Heading Tag Example" and you will see that whatever title you utilized as a part of your code is turning out as a tooltip of the cursor.

The class Attribute 

The class credit is utilized to connect a component with a template, and determines the class of component. You will take in more about the utilization of the class characteristic when you will get the hang of Cascading Style Sheet (CSS). So for the present you can maintain a strategic distance from it.

The estimation of the quality may likewise be a space-isolated rundown of class names. For instance −

class = "className1 className2 className3"

The style Attribute 

The style ascribe enables you to indicate Cascading Style Sheet (CSS) leads inside the component.

<!DOCTYPE html>
<html>

   <head>
      <title>The style Attribute</title>
   </head>
 
   <body>
      <p style = "font-family:arial; color:#FF0000;">Some text...</p>
   </body>
 
</html>

Now of time, we are not learning CSS, so simply we should continue without disturbing much about CSS. Here, you have to comprehend what are HTML qualities and how they can be utilized while designing substance.

Internationalization Attributes 

There are three internationalization qualities, which are accessible for most (in spite of the fact that not all) XHTML components.


  1. dir 
  2. lang 
  3. xml:lang 


The dir Attribute 

The dir ascribe enables you to show to the program about the course in which the content should stream. The dir property can take one of two esteems, as should be obvious in the table that takes after −

ValueMeaning
ltrLeft to right (the default value)
rtlRight to left (for languages such as Hebrew or Arabic that are read right to left)
Illustration 

<!DOCTYPE html>
<html dir = "rtl">

   <head>
      <title>Display Directions</title>
   </head>
 
   <body>
      This is how IE 5 renders right-to-left directed text.
   </body>
 
</html>

At the point when dir trait is utilized inside the <html> tag, it decides how content will be introduced inside the whole archive. At the point when utilized inside another tag, it controls the content's course for recently the substance of that tag.

The lang Attribute 

The lang ascribe enables you to show the primary dialect utilized as a part of an archive, yet this characteristic was kept in HTML just for in reverse similarity with prior renditions of HTML. This quality has been supplanted by the xml:lang trait in new XHTML archives.

The estimations of the lang characteristic are ISO-639 standard two-character dialect codes. Check HTML Language Codes: ISO 639 for a total rundown of dialect codes.

Case 

<!DOCTYPE html>
<html lang = "en">

   <head>
      <title>English Language Page</title>
   </head>

   <body>
      This page is using English Language
   </body>

</html>

The xml:lang Attribute 

The xml:lang characteristic is the XHTML trade for the lang trait. The estimation of the xml:lang characteristic ought to be an ISO-639 nation code as said in past area.

Non specific Attributes

Here's a table of some different properties that are promptly usable with a considerable lot of the HTML labels.

AttributeOptionsFunction
alignright, left, centerHorizontally aligns tags
valigntop, middle, bottomVertically aligns tags within an HTML element.
bgcolornumeric, hexidecimal, RGB valuesPlaces a background color behind an element
backgroundURLPlaces a background image behind an element
idUser DefinedNames an element for use with Cascading Style Sheets.
classUser DefinedClassifies an element for use with Cascading Style Sheets.
widthNumeric ValueSpecifies the width of tables, images, or table cells.
heightNumeric ValueSpecifies the height of tables, images, or table cells.
titleUser Defined"Pop-up" title of the elements.
In the event that you utilize a word processor, you should be comfortable with the capacity to make content strong, stressed, or underlined; these are only three of the ten choices accessible to show how content can show up in HTML and XHTML.

Strong Text 

Anything that shows up inside <b>...</b> component, is shown in strong as appeared beneath −

Illustration

<!DOCTYPE html>
<html>

   <head>
      <title>Bold Text Example</title>
   </head>
 
   <body>
      <p>The following word uses a <b>bold</b> typeface.</p>
   </body>
 
</html>
Italic Text 

Anything that shows up inside <i>...</i> component is shown in stressed as appeared beneath −

Illustration 

<!DOCTYPE html>
<html>

   <head>
      <title>Italic Text Example</title>
   </head>
 
   <body>
      <p>The following word uses an <i>italicized</i> typeface.</p>
   </body>
 
</html>

Underlined Text 

Anything that shows up inside <u>...</u> component, is shown with underline as appeared underneath −

Case 

<!DOCTYPE html>
<html>

   <head>
      <title>Underlined Text Example</title>
   </head>
 
   <body>
      <p>The following word uses an <u>underlined</u> typeface.</p>
   </body>
 
</html>
Strike Text 

Anything that shows up inside <strike>...</strike> component is shown with strikethrough, which is a thin line through the content as appeared beneath −

Case 

<!DOCTYPE html>
<html>

   <head>
      <title>Strike Text Example</title>
   </head>
 
   <body>
      <p>The following word uses a <strike>strikethrough</strike> typeface.</p>
   </body>
 
</html>

Monospaced Font 

The substance of a <tt>...</tt> component is composed in monospaced textual style. The greater part of the textual styles are known as factor width text styles on the grounds that distinctive letters are of various widths (for instance, the letter 'm' is more extensive than the letter 'I'). In a monospaced textual style, in any case, each letter has a similar width.

Illustration 

<!DOCTYPE html>
<html>

   <head>
      <title>Monospaced Font Example</title>
   </head>
 
   <body>
      <p>The following word uses a <tt>monospaced</tt> typeface.</p>
   </body>
 
</html>

Superscript Text 

The substance of a <sup>...</sup> component is composed in superscript; the text dimension utilized is an indistinguishable size from the characters encompassing it yet is shown a large portion of a character's stature over alternate characters.

Case 

<!DOCTYPE html>
<html>

   <head>
      <title>Superscript Text Example</title>
   </head>
 
   <body>
      <p>The following word uses a <sup>superscript</sup> typeface.</p>
   </body>
 
</html>

Subscript Text 

The substance of a <sub>...</sub> component is composed in subscript; the text dimension utilized is the same as the characters encompassing it, however is shown a large portion of a character's tallness underneath alternate characters.

Illustration 

<!DOCTYPE html>
<html>

   <head>
      <title>Subscript Text Example</title>
   </head>
 
   <body>
      <p>The following word uses a <sub>subscript</sub> typeface.</p>
   </body>
 
</html>

Embedded Text 
Anything that shows up inside <ins>...</ins> component is shown as embedded content.

Case 

<!DOCTYPE html>
<html>

   <head>
      <title>Inserted Text Example</title>
   </head>
 
   <body>
      <p>I want to drink <del>cola</del> <ins>wine</ins></p>
   </body>
 
</html>
Erased Text 

Anything that shows up inside <del>...</del> component, is shown as erased content.

Illustration 

<!DOCTYPE html>
<html>

   <head>
      <title>Deleted Text Example</title>
   </head>
 
   <body>
      <p>I want to drink <del>cola</del> <ins>wine</ins></p>
   </body>
 
</html>

Bigger Text 

The substance of the <big>...</big> component is shown one text dimension bigger than whatever remains of the content encompassing it as appeared underneath −

Case 

<!DOCTYPE html>
<html>

   <head>
      <title>Larger Text Example</title>
   </head>
 
   <body>
      <p>The following word uses a <big>big</big> typeface.</p>
   </body>
 
</html>

Littler Text 

The substance of the <small>...</small> component is shown one text dimension littler than whatever remains of the content encompassing it as appeared beneath −

Case 

<!DOCTYPE html>
<html>

   <head>
      <title>Smaller Text Example</title>
   </head>

   <body>
      <p>The following word uses a <small>small</small> typeface.</p>
   </body>

</html>
Gathering Content 

The <div> and <span> components enable you to assemble together a few components to make segments or subsections of a page.

For instance, you might need to put the greater part of the commentaries on a page inside a <div< component to demonstrate that the majority of the components inside that <div> component identify with the references. You may then join a style to this <div> component with the goal that they show up utilizing an uncommon arrangement of style rules.

Illustration 

<!DOCTYPE html>
<html>

   <head>
      <title>Div Tag Example</title>
   </head>
 
   <body>
      <div id = "menu" align = "middle" >
         <a href = "/index.htm">HOME</a> | 
         <a href = "/about/contact_us.htm">CONTACT</a> | 
         <a href = "/about/index.htm">ABOUT</a>
      </div>

      <div id = "content" align = "left" bgcolor = "white">
         <h5>Content Articles</h5>
         <p>Actual content goes here.....</p>
      </div>
   </body>
 
</html>

The <span> component, then again, can be utilized to assemble inline components as it were. In this way, in the event that you have a piece of a sentence or section which you need to amass together, you could utilize the <span> component as takes after.

Case 

<!DOCTYPE html>
<html>

   <head>
      <title>Span Tag Example</title>
   </head>
 
   <body>
      <p>This is the example of <span style = "color:green">span tag</span>
         and the <span style = "color:red">div tag</span> alongwith CSS</p>
   </body>
 
</html>

Translate

GoogleTech786. Powered by Blogger.

Subscribe Youtube

Our Facebook Page

Wikipedia

Search results

Popular Posts

Adsense