HTML Markup Tags and Lists Guide
HTML Markup Tags and Lists Guide
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Demonstration of text markup tags</title>
</head>
<body>
<!-- dummy paragraph -->
Lorem ipsum dolor sit amet consectetur adipisicing elit. Harum nulla
maiores vel explicabo veniam quidem voluptatem repudiandae
doloremque iusto eveniet? Unde minus aliquam alias tempore sed, sit
itaque molestiae mollitia.
<!-- paragraph tag -->
<p>this is a paragraph tag where i can write<br> paragraphs, multiple
lines and etc</p>
<!-- preserve white space tag -->
<pre> this is
used to
preserve
white
space
in the lines we write
</pre>
<!-- heading tag -->
<h1>this is heading</H1>
<h2>this is heading</h2>
<h3>this is heading</h3>
<h4>this is heading</h4>
<h5>this is heading</h5>
<h6>this is heading</h6>
<!--block quote tag -->
<p>this is not block quote tag</p>
<blockquote>this is used to block quote the content</blockquote>
<!-- font style tags like blod, italics,underline -->
<b>this is to bold the text</b>
<i>this to italise the text</i>
<u>this is to underline the text</u>
<!-- Horizontal rule tag -->
<hr>
<hr>
<!-- em, strong, and code tag -->
<em>emphasis tag</em>
<p>this is %d the<strong>strong tag</strong></p>
<!-- metaelement -->
<meta name="Web development" content="teachings of developing
web application">
<!-- strike tthrough text -->
<s>this is to strike th content</s><br>
<!-- superscript and subscrip -->
X<sup>2</sup></br>
X<sub>2</sub></br>
<!-- code tag -->
<code>printf("this is to print");
scanf("%d",&a);
</code><br>
<!-- inline quotation -->
<q>this is a short phrase</q><br>
<!-- big and small content -->
This is a <big>big text</big><br>
This is a <small>small text</small><br>
<!-- insert and delete the words -->
this next word is<ins>inserted</ins><br>
this next word is<del>deleted</del>
</body>
</html>
<li>Non vegetarian</li>
<ul type="square">
<li>Chicken biryani</li>
<li>mutton biryani</li>
</ul>
</ol>
</body>
</html>
</a>
<!-- link to an email address -->
<a href="[Link] download>send
mail</a>
<!-- button as link -->
<button onclick="[Link]='[Link]'">HTML
Lists</button>
<!-- <img src="[Link]
alt="MSDS_logo"> -->
</body>
</html>
Note: link to find coordinates of an image
[Link]
[Link]
<map name="shapemap">
</map>
</body>
</html>
Table and Nested Table
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Demonstration of nested table</title>
<style>
table{
width: 50%;
}
td,th{
border: 2px solid blue;
padding: 10px;
text-align: center;
}
th{
background-color: aqua;
}
</style>
</head>
<body>
<h1>simple table</h1>
<table>
<tr>
<th>first name</th>
<th>last name</th>
<th>age</th>
</tr>
<tr>
<td>pallavi</td>
<td>k</td>
<td>28</td>
</tr>
<tr>
<td>priyanka</td>
<td>pal</td>
<td>29</td>
</tr>
<tr>
<td>Divya</td>
<td>G</td>
<td>28</td>
</tr>
</table>
<h1>Nested Table</h1>
<table>
<tr>
<th>Category</th>
<th>Details</th>
</tr>
<tr>
<td>Electronics</td>
<td>
<table>
<tr>
<th>Product</th>
<th>Price</th>
</tr>
<tr>
<td>Smartphone</td>
<td>$500</td>
</tr>
<tr>
<td>Laptop</td>
<td>$1000</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>Furniture</td>
<td>
<table>
<tr>
<th>Product</th>
<th>Price</th>
</tr>
<tr>
<td>Sofa</td>
<td>$300</td>
</tr>
<tr>
<td>Table</td>
<td>$150</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
</form>
</body>
</html>
CSS
Ways to insert CSS
HTML code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Document</title>
<!-- External CSS -->
<link rel="stylesheet" href="[Link]">
<!-- internal CSS -->
<style>
h2{
text-align:center;
color:rgb(116, 8, 92)
}
</style>
</head>
<body>
<h2>this is second heading</h2>
<h1>this is first heading</h1>
<!-- inline CSS -->
<p style="color: blue ; font-family: 'Segoe UI', Tahoma, Geneva,
Verdana, sans-serif; font-size: large;">this is the paragraph</p>
</body>
</html>
CSS code([Link])
body{
background-color: rgb(43, 226, 73);
}
h1 {
color: rgb(104, 10, 10);
text-align: center;
}
Simple Selector
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Selectors</title>
<style>
/* universal Selector */
*{
text-align: center;
color: brown;
}
/* element Selector */
p{
color: blue;
text-align: right;
}
/* id selector */
#para1{
color: black;
text-align: center;
font-size: x-large;
}
/* class selector */
.center{
text-align: left;
color:blueviolet;
}
.large{
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande',
'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}
</style>
</head>
<body>
<!-- element selector -->
<p>This is a paragraph tag</p>
<!-- id selector -->
<p id="para1">Hello World</p>
<!-- class selector -->
<h1 class="center large">This is class selector heading</h1>
</body>
</html>
Contextual Selectors
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Contextual Selectors</title>
<style>
/* descendent selector */
h1 em{
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande',
'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
color: blue;
}
h2 b em{
color: rgb(214, 226, 43);
}
/* child Selector */
h3 > b{
color:brown
}
/* adjacent selector */
p+h3{
color: aqua;
font-size: xx-large;
}
/* general sibling selector */
h3~h4{
text-align: center;
color: blueviolet;
}
</style>
</head>
<body>
<!-- Descendent Selector -->
<h1>this is a <em>heading</em>tag</h1>
<h2>this is a <b>heading <em>tag</em>used to bold</b></h2>
<hr><hr>
<!-- Child Selector -->
<h3>this is a <b>heading <em>tag</em>used to bold</b></h3>
<hr><hr>
<!-- Adjacent Sibling Selector -->
<p>This is a paragraph1</p>
<h3>this is heading 4</h3>
<p>this is paragraph2</p>
<h3>this is another heading1</h3>
<hr><hr>
<!-- General Sibling Selector -->
<h4>This is a heading 4</h4>
<h3>This is another heading4</h3>
<h4>This is a heading 4</h4>
</body>
</html>
CSS Properties
1. Color and Background Property
Background Property
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Background</title>
<style>
/* shorthand property called background */
body {
background: #ffffff url("img_tree.png") no-repeat right top;
body {
/* Background image */
background-image:
url("[Link]
cs=srgb&dl=[Link]&fm=jpg");
/* Background Repeat */
background-repeat: repeat;
/* background position */
background-position: right top;
/* Background attacment-Gives scrolling effect */
background-attachment: ;
</style>
</head>
<body>
<!-- Background color with opacity -->
<h1 style="background-color: green; opacity: 1;">This is a heading 1
tag</h1>
<h1 style="background-color: green; opacity: 0.6;">This is a heading
1 tag</h1>
<h1 style="background-color: green; opacity: 0.3;">This is a heading
1 tag</h1>
<h1 style="background-color: green; opacity: 0.1;">This is a heading
1 tag</h1>
<p>The background-image scrolls. Try to scroll down the page.</p>
<hr><hr>
/* we need more content to scroll the background image */
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
<p>The background-image scrolls. Try to scroll down the page.</p>
</body>
</html>
Color Property
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Properties of CSS</title>
</head>
<body>
<!-- Color Properties -->
<!-- Background color -->
<h1 style="background-color:Tomato;">Tomato</h1>
<!-- Text color -->
<h2 style="background-color: bisque; color: brown;"> this is the
text color text</h2>
<!-- Border color -->
<h2 style="border: 2px solid violet;">check the border</h2>
<hr><hr>
<!-- Css color values -->
<h1 style="background-color:rgb(255, 99, 71);">rgb(255, 99,
71)</h1>
<h1 style="background-color:#ff6347;">#ff6347</h1>
<h1 style="background-color:hsl(9, 100%, 64%);">hsl(9, 100%,
64%)</h1>
</body>
</html>
2. Font Property
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>font properties</title>
<style>
.p1 {
font-family: "Times New Roman", Times, serif;
}
.p2 {
font-family: Arial, Helvetica, sans-serif;
}
.p3 {
font-family: "Lucida Console", "Courier New", monospace;
}
</style>
</head>
<body>
<h1>CSS font-family</h1>
<p class="p1">This is a paragraph, shown in the Times New Roman font.</p>
<p class="p2">This is a paragraph, shown in the Arial font.</p>
<p class="p3">This is a paragraph, shown in the Lucida Console font.</p>
</body>
</html>
3. Text Property
!<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: lightgrey;
color: blue;
}
h1 {
background-color: rgb(248, 28, 28);
color: white;
text-decoration: wavy;
}
div {
background-color: blue;
color: white;
text-decoration: double;
}
</style>
<title>text property</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This page has a grey background color and a blue text.</p>
<div>This is a div.</div>
</body>
</html>
</body>
</html>
5. Border Property
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Border Properties</title>
<style>
h2 {
border-top-style: dotted;
border-right-style: solid;
border-bottom-style: dotted;
border-left-style: solid;
}
/* borderstyles and border width(Top Left Bottom Right)*/
[Link] {border-style: dotted; border-width: 1px 5px 10px 15px;}
/* border color(Top Left Bottom Right) */
[Link] {border-style: dashed; border-color: red green blue;}
[Link] {border-style: solid;}
[Link] {border-style: double;}
[Link] {border-style: groove;}
[Link] {border-style: ridge;}
[Link] {border-style: inset;}
[Link] {border-style: outset;}
[Link] {border-style: none;}
[Link] {border-style: hidden;}
[Link] {border-style: dotted dashed solid double;}
</style>
</head>
<body>
<!-- Border individual sides -->
<h2>The border-style Property</h2>
<p>This property specifies what kind of border to display:</p>
</body>
</html>
CSS Absolute and Relative Positioning Properties
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>position property</title>
<style>
[Link] {
position: static;
border: 3px solid #73AD21;
}
[Link] {
position: relative;
left: 30px;
border: 3px solid #73AD21;
}
[Link] {
position: fixed;
bottom: 0;
right: 0;
width: 300px;
border: 3px solid #73AD21;
}
[Link] {
position: relative;
width: 400px;
height: 200px;
border: 3px solid #73AD21;
}
[Link] {
position: absolute;
top: 80px;
right: 0;
width: 200px;
height: 100px;
border: 3px solid #73AD21;
}
[Link] {
position: -webkit-sticky;
position: sticky;
top: 0;
padding: 5px;
background-color: #cae8ca;
border: 2px solid #4CAF50;
}
</style>
</head>
<body>
<h2>position: static;</h2>
<p>An element with position: static; is not positioned in any special way; it is always positioned
according to the normal flow of the page:</p>
<div class="static">
This div element has position: static;
</div>
<p>An element with position: relative; is positioned relative to its normal position:</p>
<div class="relative">
This div element has position: relative;
</div>
<h2>position: fixed;</h2>
<p>An element with position: fixed; is positioned relative to the viewport, which means it
always stays in the same place even if the page is scrolled:</p>
<div class="fixed">
This div element has position: fixed;
</div>
<h2>position: absolute;</h2>
<p>An element with position: absolute; is positioned relative to the nearest positioned ancestor
(instead of positioned relative to the viewport, like fixed):</p>
<div style="padding-bottom:2000px">
<p>In this example, the sticky element sticks to the top of the page (top: 0), when you reach its
scroll position.</p>
<p>Scroll back up to remove the stickyness.</p>
<p>Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo,
maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis
evertitur eum. Affert laboramus repudiandae nec et. Inciderint efficiantur his ad. Eum no molestiae
voluptatibus.</p>
<p>Some text to enable scrolling.. Lorem ipsum dolor sit amet, illum definitiones no quo,
maluisset concludaturque et eum, altera fabulas ut quo. Atqui causae gloriatur ius te, id agam omnis
evertitur eum. Affert laboramus repudiandae nec et. Inciderint efficiantur his ad. Eum no molestiae
voluptatibus.</p>
</div>
</body>
</html>
Z-Indexing
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Z-index property</title>
<style>
img {
position: absolute;
left: 20px;
top: 0px;
z-index: -1;
}
/* Here we see that an element with greater stack order is always above an element with a
lower stack order: */
.container {
position: relative;
}
.black-box {
position: relative;
z-index: 1;
border: 2px solid black;
height: 100px;
margin: 30px;
}
.gray-box {
position: absolute;
z-index: 3; /* gray box will be above both green and black box */
background: lightgray;
height: 60px;
width: 70%;
left: 50px;
top: 50px;
}
.green-box {
position: absolute;
z-index: 2; /* green box will be above black box */
background: lightgreen;
width: 35%;
left: 270px;
top: -15px;
height: 100px;
}
</style>
</head>
<body>
<h1>This is a heading</h1>
<img src="[Link]
cs=srgb&dl=[Link]&fm=jpg" height="200" width="200">
<p>Because the image has a z-index of -1, it will be placed behind the text.</p>
<h1>Z-index Example</h1>
<p>An element with greater stack order is always above an element with a lower stack order.</p>
<div class="container">
<div class="black-box">Black box (z-index: 1)</div>
<div class="gray-box">Gray box (z-index: 3)</div>
<div class="green-box">Green box (z-index: 2)</div>
</div>
</body>
</html>
Animating Objects
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Animation</title>
<style>
div {
width: 100px;
height: 100px;
background-color: red;
animation-name: example;
animation-duration: 4s;
}
div {
width: 100px;
height: 50px;
background-color: red;
font-weight: bold;
position: relative;
animation: mymove 5s;
animation-fill-mode: forwards;
}
h1 {
width: 250px;
height: 100px;
background-color: red;
animation-name: example2;
animation-duration: 4s;
position: relative;
animation-delay: 4s;
animation-iteration-count: 3;
animation-direction: reverse;
}
p{
/* width: 300px; */
height: 100px;
background-color: red;
animation-name: example1;
animation-duration: 4s;
}
@keyframes example {
0% {background-color: red;}
25% {background-color: yellow;}
50% {background-color: blue;}
100% {background-color: green;}
}
@keyframes example2 {
0% {background-color:red; left:0px; top:0px;}
25% {background-color:yellow; left:200px; top:0px;}
50% {background-color:blue; left:200px; top:200px;}
75% {background-color:green; left:0px; top:200px;}
100% {background-color:red; left:0px; top:0px;}
}
@keyframes example1 {
from {background-color: red;}
to {background-color: yellow;}
}
#div1 {animation-timing-function: linear;}
#div2 {animation-timing-function: ease;}
#div3 {animation-timing-function: ease-in;}
#div4 {animation-timing-function: ease-out;}
#div5 {animation-timing-function: ease-in-out;}
@keyframes mymove {
from {left: 0px;}
to {left: 300px;}
}
</style>
</head>
<body>
<h1>CSS Animation</h1>
<div></div>
<div id="div1">linear</div>
<div id="div2">ease</div>
<div id="div3">ease-in</div>
<div id="div4">ease-out</div>
<div id="div5">ease-in-out</div>
</body>
</html>