HTML(Hyper Text Markup Language) is the standard language use to create and structure content on the web.
Why learn html: because we need to create website for that we need html, or because of content.
Getting with HTML
Tip: type - html:5
/ !
- for boilerplate code
Boilerplate Code
<!DOCTYPE html> <!-- tells that we are using HTML5 -->
<html lang="en"> <!--The tag represents the root of an HTML document.-->
<head> <!-- head is a container for metadata (data about data)-->
<meta charset="UTF-8"> <!--tag defines metadata about an HTML document-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title> <!--defines the title of the document.-->
</head>
<body> <!-- defines the document's body.-->
<!-- content added here -->
</body>
</html>
Tags in HTML
<h1></h1>
- heading tag and Most Importance<h2></h2>
- less Importance than h1<h3></h3>
- less Importance than h2<h4></h4>
- less Importance than h3<h5></h5>
- less Importance than h4<h6></h6>
- less Importance than h5<p></p>
- paragraph tag used to add paragraph/text on website<b></b>
- used to bold the text<i></i>
- used to italic the text<sup></sup>
- used for to add super script<sub></sub>
- used to add sub script<br></br>
- used to break line<hr>
- used to add horizontal row<ol></ol>
- used to add ordered list<ul></ul>
- used to add unordered list<li></li>
- used to add items in list<a href ="source"> </a>
- used to make text clickable/hyperlink- Tip: to open link in new tab use this
target="_blank"
- Tip: to open link in new tab use this
<img src="source" alt=" ">
- used to add image to website<form></form>
- used to create the form<label></label>
- used to add label to input field<input id ="abc" type="text" placeholder="Name" >
- used to add input field<div></div>
- div is rectangle in his nature with 0 height
- div is used to combine multiple elements together in html
<table></table>
- A table in HTML consists of table cells inside rows and columns.<td></td>
- Each table cell is defined by a and a tag<tr></tr>
- table row starts with a and ends with a tag<th></th>
- Defines a header cell in a table
Input Types for Input tag
- text :
<input type="text" placeholder="Name">
- email :
<input type="email" placeholder="Email">
- password :
<input type="password" placeholder="Password">
- checkbox :
<input type="checkbox" >
- radio button :
<input type="radio" > Male
- file :
<input type="file" >
- range :
<input type="range" >
- color:
<input type="color" >
- date :
<input type="date" >
- submit :
<input type="submit" >
id:
id is attribute that is used to assign id to an element. It is very helpful when we have multiple of same type but we need to treat them differently. id must be unique of element.
class:
As we know that we are not allowed to assign same id to different element but when we need this type of thing we use the class attribute.
HTML5 Semantics
HTML5 semantics refers to the use of specific tags like <header>
,<footer>
,<nav>
,<article>
,<section>
,etc, to provide clearer structure and meaning to web content. This improves accessibility, better SEO, and facilitates better better understanding by both human and machines, These tags did not to something special they act like normal div but with clearer structure and meaning about there content.
Semantics Elements
<header>
: First section website can be called headernav
: Navigation bar.<main>
: complete website in this tag.<section>
: A page can split into sections like introduction, contact information, Details, etc and each of these sections can be in a different section tag.<article>
: It contains independent content which does not require any other context, blog post, newspaper article etc.<aside>
: It is used to place content in a sidebar i.e aside from the existing content. IT is related to surrounding context.<footer>
: Footer located at the bottom of any article or document, they can contain contact details, copyright information etc. There can be multiple footers on a page.<audio>
: use to add audio support<video>
: use to add video support