index.html
Hello World!, create a file named index.html
and
write -
<html>Hello World!</html>
<!DOCTYPE html> <html> <head> <title> Page Title </title> </head> <body> <h1> Heading </h1> <p> Paragraph </p> </body> </html>
Tags - <tag> Content.... </tag>
Attributes - <tag attribute="key: value;">
or
<tag attribute="value;">
Elements -
<tag attribute="key: value;"> Content.... </tag>
or Tag + Attribute
<!DOCTYPE html>
- Defines HTML 5 version
<html>
- html starts here
</html>
- html ends here
Contains meta data
<head>
- head starts here
</head>
- head ends here
<title> Site Title </title>
Contains Body content
<body>
- body starts here
</body>
- body ends here
<h1>....</h1>
<h2>....</h2>
<h3>....</h3>
<h4>....</h4>
<h5>....</h5>
<h6>....</h6>
<p>....</p>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Non, nisi?
<a href="url">....</a>
<br />
Lorem, ipsum dolor sit amet
consectetur adipisicing elit. Amet, fugit.
<hr />
Click CTRL + U in an HTML page, or right-click on the page and select "View Page Source". This will open a new tab containing the HTML source code of the page.
Right-click on an element (or a blank area), and choose "Inspect" to see what elements are made up of (you will see both the HTML and the CSS). You can also edit the HTML or CSS on-the-fly in the Elements or Styles panel that opens.
<!-- comment -->
Shortcut - CTRL + /
<h1>----<h6>
<p>
<div>
<hr>
<header>
<nav>
<main>
<footer>
<section>
<article>
<ul>
<ol>
<li>
<dl>
<dt>
<dd>
<table>
<form>
<a>
<span>
<img>
<br>
<button>
<input>
<select>
<b>
<i>
<q>
<sub>
<sup>
<textarea>
These tags directly impact the visual appearance of the text, altering font styles, sizes, and other visual properties.
<b>
- bold
<i>
- italic
These tags denote the logical or semantic value of the text. They convey meaning without directly affecting the visual appearance.
<strong>
- strong
<em>
- emphasize
<sub>
- Abcd Subscript
<sup>
- Abcd Superscript
<mark>
- marked
<del>
- deleted
<ins>
- inserted
<q>
- Abcd Quotes
<blockquote>
- Abcd
Blockquotes
<cite>
- Abcd Cite
<abbr title="">
- Abcd
Abbreviation
<address>
- Abcd
<bdo dir="ltr">
- Abcd Address
<bdo dir="rtl">
- Abcd Address
HTML tables allow web developers to arrange data into rows and columns.
<table>
- table tag
<tr>
- table row tag
<th>
- table header tag
<td>
- table data tag
<table> <tr> <th>Name</th> <th>Phone</th> <th>Email</th> </tr> <tr> <td>Arvind</td> <td>11223344</td> <td>a123@mail.com</td> </tr> <tr> <td>Bhanu</td> <td>123123</td> <td>b111@mail.com</td> </tr> <tr> <td>Chandan</td> <td>12344321</td> <td>c121@mail.com</td> </tr> </table>
Name | Phone | |
---|---|---|
Arvind | 11223344 | a123@mail.com |
Bhanu | 123123 | b111@mail.com |
Chandan | 12344321 | c121@mail.com |
<td rowspan="2">....</td>
Example:
Name | Jill |
---|---|
Phone | 555-1234 |
555-8745 |
<td colspan="3">....</td>
Example:
Name | Age | |
---|---|---|
Jill | Smith | 43 |
Eve | Jackson | 57 |
<ul>
- Unordered List
<ol>
- Ordered List
<li>
- List Item
<dl>
- Description List
<dt>
- Description Title
<dd>
- Description Data
<form>
<label>
<input>
<select>
<option>
<textarea>
Syntax - <img src="" alt="" />
Example -
Syntax - <audio src="" controls></audio>
Example -
Syntax - <video src="" controls></video>
Example -
Syntax - <object data=""></object>
Example - .pdf file
Syntax - <embed src="" />
Example - .txt file
Syntax - <iframe src=""></iframe>
Example - for web page
Syntax - <a href="" download></a>
Example - Download
The HTML class attribute is used to specify a class for an HTML element. Multiple HTML elements can share the same class.
Syntax - <p class=""></p>
.className{ // CSS }
document.getElementsByClassName("className") // js
The HTML id attribute is used to specify a unique id for an HTML element. You cannot have more than one element with the same id in an HTML document.
Syntax - <p id=""></p>
#IDName{ // css }
document.getElementById("IDName") // js
There are three ways to link css to a html file -
<h1 style="color: red; background-color: blue;"> Heading </h1>
<!DOCTYPE html>
<html>
<head>
<title> Page Title </title>
<style>
h1{
color: red;
background-color: blue;
}
</style>
</head>
<body>
<h1> Heading </h1>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title> Page Title </title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<h1> Heading </h1>
</body>
</html>
h1{ color: red; background-color: blue; }