HTML Only
HTML Only
1
                                                                                                                   ACMS
     HTML
     HTML or HTML 5 tutorial provides basic and advanced concepts of html. Our HTML tutorial is developed for
     beginners and professionals. The major points of HTML are given below:
1.   <!DOCTYPE>
2.   <html>
3.   <body>
4.   <h1>Write Your First Heading</h1>
5.   <p>Write Your First Paragraph.</p>
6.   </body>
7.   </html>
     HTML 5 Tags
     In this tutorial, we will learn HTML 5 tags such as audio tag, video tag, canvas tag, HTML svg, HTML geolocation,
     HTML drag and drop etc.
     What is HTML
                                                                                                                            2
                                                                                                              ACMS
     HTML is an acronym which stands for Hyper Text Markup Language. Let's see what is Hyper Text and what is
     Markup Language?
     Hyper Text: Hyper Text simply means "Text within Text". A text has a link within it, is a hypertext. Every time
     when you click on a word which brings you to a new webpage, you have clicked on a hypertext.
     Markup language: A markup language is a programming language that is used make text more interactive and
     dynamic. It can turn a text into images, tables, links etc.
An HTML document is made of many HTML tags and each HTML tag contains different content.
1.   <!DOCTYPE>
2.   <html>
3.   <body>
4.   <h1>Write Your First Heading</h1>
5.   <p>Write Your First Paragraph.</p>
6.   </body>
7.   </html>
body : Text between body tag describes the body content of the page that is visible to the end user.
                                                                                                                       3
                                                                                                            ACMS
Tim Berners-Lee is known as father of HTML. The first available description of HTML was a document called
"HTML Tags" proposed by Tim in late 1991.
Features of HTML
1) It is a very easy and simple language. It can be easily understood and modified.
2) It is very easy to make effective presentation with HTML because it has a lot of formatting tags.
3) It is a markup language so it provides a flexible way to design web pages along with the text.
4) It facilitates programmers to add link on the web pages (by html anchor tag) , so it enhances the interest of
browsing of the user.
5) It is platform-independent because it can be displayed on any platform like Windows, Linux and Macintosh etc.
6) It facilitates the programmer to add Graphics, Videos, and Sound to the web pages which makes it more
attractive and interactive.
HTML Tags
HTML tags contain three main parts: opening tag, content and closing tag. But some HTML tags are unclosed tags.
When a web browser reads an HTML document, browser reads it from top to bottom and left to right. HTML tags
are used to create HTML documents and render their properties. Each HTML tags have different properties.
Syntax
<tag> content </tag>
                                                                                                                   4
                                                                                                ACMS
<br> Tag: br stands for break line, it breaks the line of the code.
<hr> Tag: hr stands for Horizontal Rule. This tag is used to put a line across the webpage.
HTML Formatting
HTML Formatting
HTML Formatting is a process of formatting text for better look and feel. There are many formatting tags in
HTML. These tags are used to make text bold, italicized, or underlined. There are almost 12 options available that
how text appears in HTML and XHTML.
1) Bold Text
If you write anything within <b>............</b> element, is shown in bold letters.
                                                                                                                     6
                                                                                                            ACMS
Output:
     2) Italic Text
     If you write anything within <i>............</i> element, is shown in italic letters.
Output:
Output:
     4) Underlined Text
     If you write anything within <u>.........</u> element, is shown in underlined text.
                                                                                                               7
                                                                                                                         ACMS
Output:
     5) Strike Text
     Anything written within <strike>.......................</strike> element is displayed with strikethrough. It is a thin line
     which cross the statement.
Output:
     6) Monospaced Font
     If you want that each letter has the same width then you should write the content within <tt>.............</tt> element.
     Note: We know that most of the fonts are known as variable-width fonts because different letters have different
     width. (for example: 'w' is wider than 'i'). Monospaced Font provides similar space among every letter.
Output:
7) Superscript Text
                                                                                                                                   8
                                                                                                                     ACMS
     If you put the content within <sup>..............</sup> element, is shown in superscript ; means it is displayed half a
     character's height above the other characters.
Output:
     8) Subscript Text
     If you put the content within <sub>..............</sub> element, is shown in subscript ; means it is displayed half a
     character's height below the other characters.
Output:
     9) Deleted Text
     Anything that puts within <del>..........</del> is displayed as deleted text.
Output:
Output:
Output:
Output:
HTML Heading
                                                                                                                               10
                                                                                                                 ACMS
     HTML Heading
     A HTML heading or HTML h tag can be defined as a title or a subtitle which you want to display on the webpage.
     When you place the text within the heading tags <h1>.........</h1>, it is displayed on the browser in the bold format
     and size of the text depends on the number of heading.
There are six different HTML headings which are defined with the <h1> to <h6> tags.
     h1 is the largest heading tag and h6 is the smallest one. So h1 is used for most important heading and h6 is used for
     least important.
Output:
     Heading no. 1
     Heading no. 2
     Heading no. 3
Heading no. 4
Heading no. 5
Heading no. 6
     Heading elements (h1....h6) should be used for headings only. They should not be used just to make text
     bold or big.
     HTML Paragraph
     HTML paragraph or HTML p tag is used to define a paragraph in a webpage. Let's take a simple example to see
     how it work. It is a notable point that a browser itself add an empty line before and after a paragraph.
                                                                                                                         11
                                                                                                                ACMS
Output:
1.    <p>
2.    I am
3.    going to provide
4.    you a tutorial on HTML
5.    and hope that it will
6.    be very beneficial for you.
7.    </p>
8.    <p>
9.    Look, I put here a lot
10.   of spaces              but     I know, Browser will ignore it.
11.   </p>
12.   <p>
13.   You cannot determine the display of HTML</p>
14.   <p>because resized windows may create different result.
15.   </p>
Output:
I am going to provide you a tutorial on HTML and hope that it will be very beneficial for you.
Look, I put here a lot of spaces but I know, Browser will ignore it.
                                                                                                                       12
                                                                                                                      ACMS
As you can see, all the extra lines and unnecessary spaces are removed by the browser.
     HTML Anchor
     The HTML anchor tag defines a hyperlink that links one page to another page. The "href" attribute is the most
     important attribute of the HTML a tag.
     The href attribute is used to define the address of the file to be linked. In other words, it points out the destination
     page.
     HTML Image
     HTML img tag is used to display image on the web page. HTML img tag is an empty tag that contains attributes
     only, closing tags are not used in HTML image element.
Output:
                                                                                                                                13
                                                                                                                  ACMS
1) src
It is a necessary attribute that describes the source or path of the image. It instructs the browser where to look for the
image on the server.
2) alt
The alt attribute defines an alternate text for the image, if it can't be displayed. The value of the alt attribute describe
the image in words. The alt attribute is considered good for SEO prospective.
3) width
It is an optional attribute which is used to specify the width to display the image. It is not recommended now. You
should apply CSS in place of width attribute.
4) height
It specifies the height of the image. The HTML height attribute also supports iframe, image and object elements. It
is not recommended now. You should apply CSS in place of height attribute.
HTML Table
HTML table tag is used to display data in tabular form (row * column). There can be many columns in a row.
HTML tables are used to manage the layout of the page e.g. header section, navigation bar, body content, footer
section etc. But it is recommended to use div tag over table to manage the layout of the page .
                                                                                                                          14
                                                                                                             ACMS
<col> It is used with <colgroup> element to specify column properties for each column.
1.   <table>
2.   <tr><th>First_Name</th><th>Last_Name</th><th>Marks</th></tr>
3.   <tr><td>Sonoo</td><td>Jaiswal</td><td>60</td></tr>
4.   <tr><td>James</td><td>William</td><td>80</td></tr>
5.   <tr><td>Swati</td><td>Sironi</td><td>82</td></tr>
6.   <tr><td>Chetna</td><td>Singh</td><td>72</td></tr>
7.   </table>
Output:
James William 80
Swati Sironi 82
         Chetna       Singh        72
                                                                                                                      15
                                                                                                           ACMS
In the above html table, there are 5 rows and 3 columns = 5 * 3 = 15 values.
You can use border attribute of table tag in HTML to specify border. But it is not recommended now.
1.   <table border="1">
2.   <tr><th>First_Name</th><th>Last_Name</th><th>Marks</th></tr>
3.   <tr><td>Sonoo</td><td>Jaiswal</td><td>60</td></tr>
4.   <tr><td>James</td><td>William</td><td>80</td></tr>
5.   <tr><td>Swati</td><td>Sironi</td><td>82</td></tr>
6.   <tr><td>Chetna</td><td>Singh</td><td>72</td></tr>
7.   </table>
Output:
Sonoo Jaiswal 60
James William 80
Swati Sironi 82
Chetna Singh 72
1.   <style>
2.   table, th, td {
3.      border: 1px solid black;
4.   }
5.   </style>
                                                                                                             16
                                                                                                              ACMS
You can collapse all the borders in one border by border-collapse property.
1.   <style>
2.   table, th, td {
3.      border: 2px solid black;
4.      border-collapse: collapse;
5.   }
6.   </style>
Output:
     The cellpadding attribute of HTML table tag is obselete now. It is recommended to use CSS. So let's see the code of
     CSS.
1.   <style>
2.   table, th, td {
3.      border: 1px solid pink;
4.      border-collapse: collapse;
5.   }
6.   th, td {
7.      padding: 10px;
8.   }
9.   </style>
Output:
Sonoo Jaiswal 60
                                                                                                                      17
                                                                                                ACMS
James William 80
Swati Sironi 82
Chetna Singh 72
CSS code:
1.   <style>
2.   table, th, td {
3.      border: 1px solid black;
4.      border-collapse: collapse;
5.   }
6.   th, td {
7.      padding: 5px;
8.   }
9.   </style>
HTML code:
1. <table style="width:100%">
2.   <tr>
3.     <th>Name</th>
4.     <th colspan="2">Mobile No.</th>
5.   </tr>
6.   <tr>
7.     <td>Ajeet Maurya</td>
8.     <td>7503520801</td>
9.     <td>9555879135</td>
10. </tr>
11. </table>
Output:
                                                                                                  18
                                                                                             ACMS
CSS code:
1.   <style>
2.   table, th, td {
3.      border: 1px solid black;
4.      border-collapse: collapse;
5.   }
6.   th, td {
7.      padding: 10px;
8.   }
9.   </style>
HTML code:
1.   <table>
2.   <tr><th>Name</th><td>Ajeet Maurya</td></tr>
3.   <tr><th rowspan="2">Mobile No.</th><td>7503520801</td></tr>
4.   <tr><td>9555879135</td></tr>
5.   </table>
Output:
                          7503520801
       Mobile No.
                          9555879135
1.   <table>
2.   <caption>Student Records</caption>
3.   <tr><th>First_Name</th><th>Last_Name</th><th>Marks</th></tr>
4.   <tr><td>Vimal</td><td>Jaiswal</td><td>70</td></tr>
5.   <tr><td>Mike</td><td>Warn</td><td>60</td></tr>
6.   <tr><td>Shane</td><td>Warn</td><td>42</td></tr>
7.   <tr><td>Jai</td><td>Malhotra</td><td>62</td></tr>
8.   </table>
                                                                                               19
                                                                                                                 ACMS
1.    <style>
2.    table, th, td {
3.       border: 1px solid black;
4.       border-collapse: collapse;
5.    }
6.    th, td {
7.       padding: 10px;
8.    }
9.    table#alter tr:nth-child(even) {
10.      background-color: #eee;
11.   }
12.   table#alter tr:nth-child(odd) {
13.      background-color: #fff;
14.   }
15.   table#alter th {
16.      color: white;
17.      background-color: gray;
18.   }
19.   </style>
Output:
      HTML Lists
      HTML Lists are used to specify lists of information. All lists may contain one or more list elements. There are three
      different types of HTML lists:
                                                                                                                         20
                                                                                                                  ACMS
1.   <ol>
2.   <li>Aries</li>
3.   <li>Bingo</li>
4.   <li>Leo</li>
5.   <li>Oracle</li>
6.   </ol>
Output:
         1.    Aries
         2.    Bingo
         3.    Leo
         4.    Oracle
Click here for full details of HTML ordered list. HTML Ordered List
1.   <ul>
2.   <li>Aries</li>
3.   <li>Bingo</li>
4.   <li>Leo</li>
5.   <li>Oracle</li>
6.   </ul>
Output:
              Aries
              Bingo
              Leo
              Oracle
                                                                                                                       21
                                                                                                                   ACMS
Click here for full details of HTML unordered list. HTML Unordered List
The definition list is very appropriate when you want to present glossary, list of terms or other name-value list.
1.    <dl>
2.     <dt>Aries</dt>
3.     <dd>-One of the 12 horoscope sign.</dd>
4.     <dt>Bingo</dt>
5.     <dd>-One of my evening snacks</dd>
6.    <dt>Leo</dt>
7.    <dd>-It is also an one of the 12 horoscope sign.</dd>
8.     <dt>Oracle</dt>
9.     <dd>-It is a multinational technology corporation.</dd>
10.   </dl>
Output:
      Aries
                 -One of the 12 horoscope sign.
      Bingo
                 -One of my evening snacks
      Leo
                 -It is also an one of the 12 horoscope sign.
      Oracle
                 -It is a multinational technology corporation.
                                                                                                                           22
                                                                                                                    ACMS
To represent different ordered lists, there are 5 types of attributes in <ol> tag.
      Type                  Description
          Type "1"              This is the default type. In this type, the list items are numbered with numbers.
Type "I" In this type, the list items are numbered with upper case roman numbers.
Type "i" In this type, the list items are numbered with lower case roman numbers.
Type "A" In this type, the list items are numbered with upper case letters.
Type "a" In this type, the list items are numbered with lower case letters.
1.   <ol>
2.   <li>HTML</li>
3.   <li>Java</li>
4.   <li>JavaScript</li>
5.   <li>SQL</li>
6.   </ol>
Output:
         1.    HTML
         2.    Java
         3.    JavaScript
         4.    SQL
     ol type="I"
     Let's see the example to display list in roman number uppercase.
1.   <ol type="I">
                                                                                                                      23
                                                                        ACMS
2.   <li>HTML</li>
3.   <li>Java</li>
4.   <li>JavaScript</li>
5.   <li>SQL</li>
6.   </ol>
Output:
        I.     HTML
       II.     Java
      III.     JavaScript
      IV.      SQL
     ol type="i"
     Let's see the example to display list in roman number lowercase.
1.   <ol type="i">
2.   <li>HTML</li>
3.   <li>Java</li>
4.   <li>JavaScript</li>
5.   <li>SQL</li>
6.   </ol>
Output:
        i.     HTML
       ii.     Java
      iii.     JavaScript
      iv.      SQL
     ol type="A"
     Let's see the example to display list in alphabet uppercase.
1.   <ol type="A">
2.   <li>HTML</li>
3.   <li>Java</li>
4.   <li>JavaScript</li>
5.   <li>SQL</li>
6.   </ol>
Output:
             A. HTML
                                                                          24
                                                                                              ACMS
         B. Java
         C. JavaScript
         D. SQL
     ol type="a"
     Let's see the example to display list in alphabet lowercase.
1.   <ol type="a">
2.   <li>HTML</li>
3.   <li>Java</li>
4.   <li>JavaScript</li>
5.   <li>SQL</li>
6.   </ol>
Output:
         a.    HTML
         b.    Java
         c.    JavaScript
         d.    SQL
     start attribute
     The start attribute is used with ol tag to specify from where to start the list items.
<ol type="1" start="5"> : It will show numeric values starting with "5".
<ol type="A" start="5"> : It will show capital alphabets starting with "E".
<ol type="a" start="5"> : It will show lower case alphabets starting with "e".
<ol type="I" start="5"> : It will show Roman upper case value starting with "V".
<ol type="i" start="5"> : It will show Roman lower case value starting with "v".
                                                                                                25
                                                                                                                      ACMS
Output:
        v.       HTML
       vi.       Java
      vii.       JavaScript
     viii.       SQL
                disc
                circle
                square
                none
To represent different ordered lists, there are 4 types of attributes in <ul> tag.
Type Description
Type "disc" This is the default style. In this style, the list items are marked with bullets.
Type "circle" In this style, the list items are marked with circles.
Type "square" In this style, the list items are marked with squares.
Type "none" In this style, the list items are not marked .
Output:
                HTML
                Java
                JavaScript
                SQL
                                                                                                                               26
                            ACMS
     ul type="circle"
1.   <ul type="circle">
2.   <li>HTML</li>
3.   <li>Java</li>
4.   <li>JavaScript</li>
5.   <li>SQL</li>
6.   </ul>
Output:
         o     HTML
         o     Java
         o     JavaScript
         o     SQL
     ul type="square"
1.   <ul type="square">
2.   <li>HTML</li>
3.   <li>Java</li>
4.   <li>JavaScript</li>
5.   <li>SQL</li>
6.   </ul>
Output:
              HTML
              Java
              JavaScript
              SQL
     ul type="none"
1.   <ul type="none">
2.   <li>HTML</li>
3.   <li>Java</li>
4.   <li>JavaScript</li>
5.   <li>SQL</li>
6.   </ul>
Output:
                              27
                                                                                                              ACMS
                 HTML
                 Java
                 JavaScript
                 SQL
1.    <dl>
2.     <dt>HTML</dt>
3.     <dd>is a markup language</dd>
4.     <dt>Java</dt>
5.     <dd>is a programming language and platform</dd>
6.    <dt>JavaScript</dt>
7.    <dd>is a scripting language</dd>
8.     <dt>SQL</dt>
9.     <dd>is a query language</dd>
10.   </dl>
Output:
      HTML
                  is a markup language
      Java
                  is a programming language and platform
      JavaScript
                  is a scripting language
      SQL
                  is a query language
      HTML Form
      An HTML form is a section of a document which contains controls such as text fields, password fields,
      checkboxes, radio buttons, submit button, menus etc.
      An HTML form facilitates the user to enter data that is to be sent to the server for processing.
                                                                                                                     28
                                                                                                               ACMS
     For example: If a user want to purchase some items on internet, he/she must fill the form such as shipping address
     and credit/debit card details so that item can be sent to the given address.
      Tag                                 Description
          <form>                               It defines an HTML form to enter inputs by the used side.
      Tag                               Description
          <datalist>                        It specifies a list of pre-defined options for input control.
1.   <form>
2.     First Name: <input type="text" name="firstname"/> <br/>
3.     Last Name: <input type="text" name="lastname"/> <br/>
4.   </form>
     If you click on the label tag, it will focus on the text control. To do so, you need to have for attribute in label tag that
     must be same as id attribute of input tag.
1.   <form>
2.     <label for="firstname">First Name: </label>
3.            <input type="text" id="firstname" name="firstname"/> <br/>
4.     <label for="lastname">Last Name: </label>
5.            <input type="text" id="lastname" name="lastname"/> <br/>
6.   </form>
1.   <form>
2.      <label for="password">Password: </label>
3.            <input type="password" id="password" name="password"/> <br/>
4.   </form>
                                                                                                                              30
                                                                                                                 ACMS
1.   <form>
2.      <label for="email">Email: </label>
3.            <input type="email" id="email" name="email"/> <br/>
4.   </form>
If you use one name for all the radio buttons, only one radio button can be selected at a time.
1.   <form>
2.      <label for="gender">Gender: </label>
3.            <input type="radio" id="gender" name="gender" value="male"/>Male
4.            <input type="radio" id="gender" name="gender" value="female"/>Female <br/>
5.   </form>
     Checkbox Control
     The checkbox control is used to check multiple options from given checkboxes.
1.   <form>
2.   Hobby:<br>
3.           <input type="checkbox" id="cricket" name="cricket" value="cricket"/>
4.             <label for="cricket">Cricket</label>
5.           <input type="checkbox" id="football" name="football" value="football"/>
6.             <label for="football">Football</label>
7.           <input type="checkbox" id="hockey" name="hockey" value="hockey"/>
8.             <label for="hockey">Hockey</label>
9.   </form>
1.   <form action="#">
2.   <table>
                                                                                                                        31
                                                                                                                  ACMS
3.    <tr>
4.       <td class="tdLabel"><label for="register_name" class="label">Enter name:</label></td>
5.       <td><input type="text" name="name" value= id="register_name" style="width:160px"/></td>
6.    </tr>
7.    <tr>
8.       <td class="tdLabel"><label for="register_password" class="label">Enter password:</label></td>
9.       <td><input type="password" name="password" id="register_password" style="width:160px"/></td>
10.   </tr>
11.   <tr>
12.      <td class="tdLabel"><label for="register_email" class="label">Enter Email:</label></td>
13.      <td
14.   ><input type="email" name="email" value= id="register_email" style="width:160px"/></td>
15.   </tr>
16.   <tr>
17.      <td class="tdLabel"><label for="register_gender" class="label">Enter Gender:</label></td>
18.      <td>
19.   <input type="radio" name="gender" id="register_gendermale" value="male"/>
20.   <label for="register_gendermale">male</label>
21.   <input type="radio" name="gender" id="register_genderfemale" value="female"/>
22.   <label for="register_genderfemale">female</label>
23.      </td>
24.   </tr>
25.   <tr>
26.      <td class="tdLabel"><label for="register_country" class="label">Select Country:</label></td>
27.      <td><select name="country" id="register_country" style="width:160px">
28.      <option value="india">india</option>
29.      <option value="pakistan">pakistan</option>
30.      <option value="africa">africa</option>
31.      <option value="china">china</option>
32.      <option value="other">other</option>
33.   </select>
34.   </td>
35.   </tr>
36.   <tr>
37.      <td colspan="2"><div align="right"><input type="submit" id="register_0" value="register"/>
38.   </div></td>
39.   </tr>
40.   </table>
41.   </form>
      HTML Textarea
      The HTML <textarea> tag is used to define a multi-line text input control.
It can hold unlimited number of characters and the texts are displayed in a fixed-width font (usually courier).
      The size of the HTML textarea is defined by <cols> and <rows> attribute, or it can also be defined through CSS
      height and width properties.
                                                                                                                        32
                                                                                                                  ACMS
Output:
maxlength It specifies the maximum number of characters allowed in the text area.
placeholder It specifies a short hint that describes the expected value of a textarea.
         wrap                  It specifies that how the texts in the textarea are wrapped at the time of the submission of the
                               form.
                                                                                                                            33
                                                                                                             ACMS
Output:
                               Submit
     Name:
The textarea element above is outside the form , but it is still the part of the form.
     HTML Title
     HTML title tag is used to provide a title name for your webpage. It is necessary for Search Engine Optimization
     (SEO).
The HTML title tag must be used inside the <head> tag.
The title of the page is displayed on the title bar of the browser.
1.   <!DOCTYPE html>
2.   <html>
3.   <head>
4.     <title>First web page.</title>
5.   </head>
6.   <body>
7.     <p>Welcome to my first web page.</p>
8.   </body>
9.   </html>
                                                                                                                       34
                                                                                                                  ACMS
     Here you see that we are using two elements, the head tag and the title tag. The whole title element is within the
     head tag.
     The head element which appears before body element just contains the information about the page but it doesn't
     display on the browser window. So, to display a title name on the web page, title element is used.
     If you look at the above example, you will see that "First web page" will be displayed on the tab/ title bar of the
     browser. Content(text) between <title>.............</title> is shown on the title bar.
     We know that every tag has a specific purpose e.g. p tag is used to specify paragraph, <h1> to <h6> tag are used to
     specify headings but the <div> tag is just like a container unit which is used to encapsulate other page elements and
     divides the HTML documents into sections.
     The div tag is generally used by web developers to group HTML elements together and apply CSS styles to many
     elements at once. For example: If you wrap a set of paragraph elements into a div element so you can take the
     advantage of CSS styles and apply font style to all paragraphs at once instead of coding the same style for each
     paragraph element.
Output:
                                                                                                                           35
                                                                                                                  ACMS
          HTML div element is used to wrap large sections           HTML span element is used to wrap
          of elements.                                              small portion of texts, image etc.
CSS Code:
1.    .loginform{
2.       padding:10px;
3.       border:1px solid pink;
4.       border-radius:10px;
5.       float:right;
6.       margin-top:10px;
7.    }
8.    .formheading{
9.       background-color:red;
10.      color:white;
11.      padding:4px;
12.      text-align:center;
13.   }
14.   .sub{
15.   background-color:blue;
16.   padding: 7px 40px 7px 40px;
17.   color:white;
18.   font-weight:bold;
19.   margin-left:70px;
20.   border-radius:5px;
21.   }
HTML Code:
1.    <div class="loginform">
2.    <h3 class="formheading">Please Login</h3>
3.    <form action="LoginServlet" method="post">
4.    <table>
5.    <tr><td>Email:</td><td><input type="email" name="email"/></td></tr>
6.    <tr><td>Password:</td><td><input type="password" name="password"/></td></tr>
7.    <tr><td colspan="2" style="text-align:center"><input class="sub" type="submit" value="login"/></td></tr>
8.    </table>
9.    </form>
10.   </div>
                                                                                                                        36
                                                                                                                  ACMS
Output:
     Please Login
         Email:
Password:
login
It is widely used to display language examples e.g. Java, C#, C, C++ etc because it displays the code as it is typed.
Output:
                                                                                                                         37
                                                                                                          ACMS
Output:
package com.atharva;
public class FirstJava{
public static void main(String args[]){
System.out.println("hello java");
}
}
If you remove pre tag from the above example, all the text will be displayed in a single line.
package com.atharva; public class FirstJava{ public static void main(String args[]){ System.out.println("hello
java"); } }
width attribute
The HTML <pre> tag also supports the width attribute. The width attribute specifies the desired width of the pre-
formatted text. But, it is not supported in HTML 5.
Output:
     It is inside em tag.
     It is inside strong tag.
     It is inside dfn tag.
     It is inside code tag.
     It is inside samp tag.
     It is inside kbd tag.
     It is inside var tag.
Output:
EMAIL-ID:
                                                                                                                          39
                                                                                                                ACMS
PHONE NO:
1.   <form action="#">
2.   First name: <input type="text" name="FirstName" placeholder="enter firstname..."><br>
3.   Last name: <input type="text" name="LastName" placeholder="enter lastname..."><br>
4.   <input type="submit" value="Submit">
5.   </form>
Output:
First name:
     Last name:
      Submit
Click the "Submit" button for sending the form-data to a page on the server.
     Points to remember
     1) Use the input element within the form element to declare input control that allow user to enter data.
2) The input element is empty. It contains attributes only. There is no need of an end tag in HTML.
3) If you want to define labels for input element, use the label element with each input tag.
                                                                                                                     40
                                                                                                              ACMS
     HTML hr tag
     HTML <hr> tag is used to specify a paragraph-level thematic break in HTML document. It is used when you
     abruptly change your topic in your HTML document. It draw a horizontal line between them. It is also called a
     Horizontal Rule in HTML.
     HTML hr tag
1.   <h2>HTML</h2>
2.   <p>HTML is a language for describing web pages.</p>
3.   <hr/>
4.   <h2>HR Tag </h2>
5.   <p> HR tag is used to draw a horizontal line within the texts to sepate content.<p>
Output:
     HTML
     HTML is a language for describing web pages.
     HR Tag
     HR tag is used to draw a horizontal line within the texts to separate content.
                                                                                                                     41
                                                                                                             ACMS
     HTML br tag
     HTML <br> tag or element is used to break line in a paragraph.
Don't use br tag for margin between two paragraphs, use CSS margin property instead.
Output:
     HTML5
     HTML5 provides details of all 40+ HTML tags including audio, video, header, footer, data, datalist, article etc. This
     HTML tutorial is designed for beginners and professionals.
     HTML5 is a next version of HTML. Here, you will get some brand new features which will make HTML much easier.
     These new introducing features make your website layout clearer to both website designers and users. There are some
     elements like <header>, <footer>, <nav> and <article> that define the layout of a website.
It facilitate you to design better forms and build web applications that work offline.
It provides you advance features for that you would normally have to write JavaScript to do.
     The most important reason to use HTML 5 is, we believe it is not going anywhere. It will be here to serve for a long
     time according to W3C recommendation.
     HTML 5 Example
     Let's see a simple example of HTML5.
1.   <!DOCTYPE>
2.   <html>
3.   <body>
4.   <h1>Write Your First Heading</h1>
5.   <p>Write Your First Paragraph.</p>
6.   </body>
7.   </html>
                                                                                                                       43
                                                                                                             ACMS
     HTML 5 Tags
     There is a list of newly included tags in HTML 5. These HTML 5 tags (elements) provide a better document structure.
     This list shows all HTML 5 tags in alphabetical order with description.
         1.   mp3
         2.   wav
         3.   ogg
     HTML5 supports <video> and <audio> controls. The Flash, Silverlight and similar technologies are used to play the
     multimedia items.
This table defines that which web browser supports which audio file format.
1.   <audio controls>
2.    <source src="koyal.mp3" type="audio/mpeg">
3.   Your browser does not support the html audio tag.
4.   </audio>
                                                                                                                     44
                                                                                                                   ACMS
Output:
Let's see the example to play ogg file using HTML audio tag.
1.   <audio controls>
2.    <source src="koyal.ogg" type="audio/ogg">
3.   Your browser does not support the html audio tag.
4.   </audio>
      Attribute             Description
         controls               It defines the audio controls which is displayed with play/pause buttons.
autoplay It specifies that the audio will start playing as soon as it is ready.
loop It specifies that the audio file will start over again, every time when it is completed.
preload It specifies the author view to upload audio file when the page loads.
mp3 audio/mpeg
                                                                                                                           45
                                                                                             ACMS
ogg audio/ogg
wav audio/wav
The <datalist> tag should be used with an <input> element that contains a "list" attribute. The
value of "list" attribute is linked with the datalist id.
The HTML datalist tag supports global and event attributes also.
   1.     <label>
   2.     Enter your favorite cricket player: Press any character<br />
   3.     <input type="text" id="favCktPlayer" list="CktPlayers">
   4.     <datalist id="CktPlayers">
   5.     <option value="Sachin Tendulkar">
   6.     <option value="Brian Lara">
   7.     <option value="Jacques Kallis">
   8.     <option value="Ricky Ponting">
   9.     <option value="Rahul Dravid">
   10.    <option value="Shane Warne">
   11.    <option value="Rohit Sharma">
   12.    <option value="Donald Bradman">
   13.    <option value="Saurav Ganguly ">
   14.    <option value="AB diVilliers">
   15.    <option value="Mahendra Singh Dhoni">
   16.    <option value="Adam Gilchrist">
   17.    </datalist>
   18.    </label>
Output:
                                                                                                  46
ACMS
47