1) Elements
2) Their Attributes The very basic structure of a HTML document consists of a html,head, body elements. The (!DOCTYPE html) is added at the start of every document. It is a document type declaration which is a set of guidelines and regulations that must be attached to a certain online document(html,xml etc).
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
</body>
</html>
<h1> Heading 1 </h1>
<h2> Heading 2 </h2>
<h3> Heading 3 </h3>
<h4> Heading 4 </h4>
<h5> Heading 5 </h5>
<h6> Heading 6 </h6>
<p>This is a part of a paragraph </p>
OUTPUT:
This is a part of a paragraph.
- To italisize text in html we can use the italic or emphasise tags.Italic tag italisises the text inside it ,that is, it styles the text to make it slanted. But the text inside the em or emphasise tag is stresses and emphasised.
This is <i> italic </i> This is <em> emphasised </em>
This is italic
This is * emphasised* - To make text bold 2 tags can be used. Bold or strong.
This is <b> bold </b> This is <strong> strong </strong>
OUTPUT:
This is bold
This is strong
<p> I am <em> writing </em> a <strong>HTML</strong> cheatsheet.
which looks like this:
I am writing a HTML cheatsheet.
<ol>
<li>This</li>
<li>is</li>
<li>an</li>
<li>ordered list</li>
</ol>
OUTPUT:
- This
- is
- an
- ordered list
Attributes
1. Type: Sets the numbering type
<ol type="a">
<li>a for lowercase letters
</ol>
<ol type="A">
<li>A for uppercase letters
</ol>
<ol type="i">
<li>i for lowercase Roman numerals
</ol>
<ol type="I">
<li>I for uppercase Roman numerals
</ol>
<ol type="I">
<li>1 for numbers (default)
</ol>
- Start: Used to change the starting numbering value. For example, to start a ordered list from 6 we can specify start ="6".
<ol start ="6" type="a">
<li>This</li>
<li>is</li>
<li>an</li>
<li>ordered list</li>
</ol>
OUTPUT:
- This
- is
- an
- ordered list
---> Unordered list(ul)
An unordered list is something that renders a list which is bulleted. The various items inside a list are specified using (li) tag.
<ul>
<li>This</li>
<li>is</li>
<li>an</li>
<li>unordered list</li>
</ul>
OUTPUT:
- This
- is
- an
- unordered list
Attributes
1. Type: Sets the type of bullets
<ul type="circle">
<li>circle
</ul>
<ul type="disc">
<li>disc
</ul>
<ul type="square">
<li>square
</ul>
OUTPUT:
- circle
- disc
- square
<img src="image.png">
The various attributes of image are:
- src- Specifies the path to the image
- alt-Specifies an alternate text for the image, if the image for some reason cannot be displayed
- width- Specifies the width of the image
- height- Specifies the height of the image
<p> This is linked to
<a href="https://github.com"> Github </a>
</p>
OUTPUT:
This is linked to Github
To apply the styles styled using CSS in the file styles.css we can use links.
<link rel="stylesheet" href="styles.css">
<table>
<tr>
<th>Column-1</td>
<th>Column-2</td>
<th>Column-3</td>
</tr>
<tr>
<td>Text-1</td>
<td>Text-2</td>
<td>Text-3</td>
</tr>
<tr>
<td>Content-1</td>
<td>Content-2</td>
<td>Coontent-3</td>
</tr>
</table>
OUTPUT:
Column-1 | Column-2 | Column-3 |
---|---|---|
Text-1 | Text-2 | Text-3 |
Content-1 | Content-2 | Coontent-3 |
An (input) element can be displayed in many ways, depending on the type attribute.
Here are some examples:
Type | Description |
---|---|
Text | Displays a single-line text input field |
Radio | Displays a radio button (for selecting one of many choices) |
Checkbox | Displays a checkbox |
Submit | Displays a submit button |
Button | Displays a clickablebutton |
The (label) tag defines a label for many form elements.The for attribute of the (label) tag should be equal to the id attribute of the element to bind them together.
<label for="name">Your Name:</label>
<input type="text" id="name"><br>
<label for="yes">Yes </label>
<input type="Radio" id="yes"><br>
<label for="no">No</label>
<input type="checkbox" id="no"><br>
<input type="submit">
OUTPUT:
For further information regarding HTML elements and their attributes,refer to:
https://www.w3schools.com/html
https://developer.mozilla.org/en-US/docs/Web/HTML