HTML Notes (1)
HTML Notes (1)
Introduction:-
HTML Structure:-
* <html>:- An opening <html> tag should appear first and a closing </html> tag
should appear at the bottom of the document.
* <head>:- The head element is the first element to appear after the opening
html tag. In the document head we place things like the page title, we add
JavaScript to our page with the script tag, and we [link] to external style sheets
and other resources.
* <body>:- All of the content that is visible on a web page is nested between
opening and closing body tags. The body is the primary container of the content
that makes up a web page.
Example:-
<html>
<head>
</head>
<body>
</body>
</html>
HTML 5:-
HTML5 is the fifth revision of HTML, a markup language to present and
structure web document.
For example you can use audio, video, source tags to present multimedia
content easily.
Using canvas tag you can make your web document a drawing canvas.
HTML5 offers several new tags and attributes to enhance user experience
of Forms.
<! DOCTYPE HTML>:- For using HTML5 you must have to define <! DOCTYPE
HTML> at first .This tells the browser to write HTML5 Coding..
* <main>:- Use the main element between header and footer elements to
contain the primary content of your web page. The main element cannot be a
descendant of an article, aside, header, footer, or nav element. Instead, it should
be a direct descendant of the body element.
* <nav>:- Navigational menus are commonly placed at the top of a web page.in
a sidebar, or in the page footer. Wherever you happen to place a navigational
menu, wrap it in nav tags.
Example:-
<nav>
<a href="#">HTML</a> |
<a href="#">CSS</a> |
<a href="#">JavaScript</a> |
<a href="#">jQuery</a>
</nav>
*<address>:- The <address> tag defines the contact information for the
author/owner of a document or an article.If the <address> element is inside the
<body> element, it represents contact information for the document.If the
<address> element is inside an <article> element, it represents contact
information for that article.
Example:-
<address>
Written by <a href="mailto:webmaster@example.com">Jon
Doe</a>.<br>
Visit us at:<br>
Example.com<br>
Box 564, Disneyland<br>
USA
</address>
*<footer>:- The most common use of the footer element is to place it at the
bottom of an HTML document to contain things like a copyright notice, links to
related content, address information about the owner of the website, and links to
administrative things like privacy policies and website's terms of service.
example:-
<footer>
<p>Copyright technocraft solution</p
</footer>
2) Video Tag:- The <video> tag specifies video, such as a movie clip or other
video streams.You must have to save video file where your html file is
present.
<video controls>
<source src="horse.ogg" type="video/ogg">
<source src="horse.mp3" type="video/mpeg">
</video>
*src:- Path of video file
*type="video/mp3":- if you can use video tag then define video type.
Define extension of video file. Like mp3, mp4 etc....
*Controls:- it is a structure of video.
4) Head tag:-The <head> element is a container for all the head elements.
The <head> element can include a title for the document, scripts, styles and
more.We can define title of webpage in title tag which shows at top of the
browser address bar.
Example:-
<html>
<head>
<title>Title of the document</title>
</head>
<body>
The content of the document......
</body>
</html>
Output:-The content of the document......
5) < hr>Tag:- The HTML <hr> tag is used for creating a horizontal line.
Example:-
<!DOCTYPE html>
<html>
<head>
<title>HTML hr Tag</title>
</head>
<body>
<p>This text will be followed by a horizontal line <hr /></p>
</body>
</html>
Output:-This text will be followed by a horizontal line
________________________________________________
7) <i> Tag:- The content of the <i> tag is usually displayed in italic.
Example:-
<p>He named his car <i>The lightning</i>, because it was very fast.</p>
Output:-He named his car The lightning, because it was very fast.
8) <img> Tag:-The <img> tag defines an image in an HTML page. The <img> tag
has two required attributes: src and alt.
Example:-<img src="smiley.gif" width="42" height="42">
*src:-path of image
Attributes of image:-
1)height:- Specifies the height of an image in px
2)width:- Specifies the width of an image in px
9) <a>Tag:-The <a> tag defines a hyperlink, which is used to link from one page
to another.
Example:-
<html>
<body>
<a href="https://www.google.com">Visit Google.com!</a>
</body>
</html>
*href:- The most important attribute of the <a> element. Which indicates path
of specified files or links.
Output:- Visit Google.com!
12) <div> Tag:- The <div> tag defines a division or a section in an HTML
document. Define contents in div tag is not related to each other .It has separate
contents....
Example:-
<div style="background-color:lightblue">
<h3>This is a heading in a div element</h3>
<p>This is some text in a div element.</p>
</div>
13) <ol> Tag:- The <ol> tag defines an ordered list. An ordered list can be
numerical or alphabetical.
Example:-
<html>
<body>
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
</body>
</html>
Output:-
1. Coffee
2. Tea
3. Milk
14 <ul>Tag:- The <ul> tag defines an unordered (bulleted) list.Use the <ul> tag
together with the <li> tag to create unordered lists.
Example:-
<html>
<body>
<h4>An Unordered List:</h4>
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
</body>
</html>
Output:- An Unordered List:
Coffee
Tea
Milk
18 <span>Tag:-The HTML <span> tag is used for grouping and applying styles
to inline elements.
There is a difference between the span tag and the div tag. The span tag is used
with inline elements whilst the div tag is used with block-level content.
Example:-
<html>
<body>
<p>My mother has <span style="color:blue;font-weight:bold">blue</span>
eyes.</p>
</body>
</html>
Output:-My mother has blue eyes.
19) <sub> Tag:-The <sub> tag defines subscript text. Subscript text appears
half a character below the normal line,and is sometimes rendered in a smaller
font. Subscript text can be used for chemical formulas, like H 2O to be written as
H2O.
Example:-
<p>This text contains <sub>subscript</sub> text.</p>
Output:-This text contains subscript text.
24) <th> Tag:-The <th> tag defines a header cell in an HTML table.We can
give table heading
Example:-
<table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
25) <thead>:- The <thead> tag is used to group header content in an HTML
table.
Example:-
<table>
<thead>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
</thead>
34) Required:- A "Required Field" is a field that must be filled in with value
before submission of a form. Required field sometimes known as Compulsory
field. It is validation of html
If we found empty field in form then give error message like "Please enter"
Example:-Username: <input type="text" name="usrname" required>