IWP Notes Unit 2
IWP Notes Unit 2
Tags (Elements)
- Paired Tags – (<html> </html>)
- Unpaired Tags (<br>, <hr>, <img>)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<table border="1">
<tr>
<th colspan="3">Product</th>
</tr>
<tr><th>P No</th>
<th>P Name</th>
<th>Count</th>
</tr>
<tr>
<td>1</td>
<td>Soap</td>
<td rowspan="2">10</td>
</tr>
<tr>
<td>2</td>
<td>Detergent</td>
</tr>
</table>
</body>
</html>
<input type="radio"> Displays a radio button (for selecting one of many choices)
Target Attribute
- <a href=”h1.html” target=”_blank”>click </a>
- Target is: self, parent, top, blank
Mail
- <a href=mailto:[email protected]> Send mail</a>
Value Description
Attributes:
Attribute Description
checked Specifies that an input field should be pre-selected when the page loads (for
type="checkbox" or type="radio")
HTML Symbols
Symbols that are not present on your keyboard can also be added by using entities.
Display the euro sign, €, with an entity name, a decimal, and a hexadecimal value:
UTF-8 Characters
- Charset
o 48 – 57 – numbers 0 - 9
o 65 – 90 – Alphabets A-Z
o 97 – 122 – Alphabets a-z
<body>
<p>I will display A B C</p>
<p>I will display A B C</p>
</body>
Language Charset
- Language code
o <html lang=en>
o <html lang=en-IN> (country code)
Emojis in HTML
Emojis are characters from the UTF-8 character set: 😄 😍 💗
- 😄
- 🗻
- 🧦
😄 is 128516
😍 is 128525
💗 is 128151
A Uniform Resource Locator (URL) is used to address a document (or other data) on the
web.
scheme://prefix.domain:port/path/filename
scheme - defines the type of Internet service (most common is http or https)
prefix - defines a domain prefix (default for http is www)
domain - defines the Internet domain name (like w3schools.com)
port - defines the port number at the host (default for http is 80)
path - defines a path at the server (If omitted: the root directory of the site)
filename - defines the name of a document or resource
The <map> element is used to create an image map, and is linked to the image by using
the required name attribute:
<map name="workmap">
The name attribute must have the same value as the <img>'s usemap attribute .
<map name="workmap">
<area shape="rect" coords="290,172,333,250" alt="Phone" href="phone.htm">
<area shape="circle" coords="337,300,44" alt="Coffee" href="coffee.htm">
</map>
The coordinates for shape="rect" come in pairs, one for the x-axis and one for the y-axis.
The coordinates 270,350 is located 270 pixels from the left margin and 350 pixels from
the top:
<map name="workmap">
HTML - Frames
HTML frames are used to divide your browser window into multiple sections where each
section can load a separate HTML document.
A collection of frames in the browser window is known as a frameset. The window is
divided into frames in a similar way the tables are organized into rows and columns.
Disadvantages of Frames
There are few drawbacks with using frames, so it's never recommended to use frames in
your webpages −
Some smaller devices cannot cope with frames often because their screen is not
big enough to be divided up.
Sometimes your page will be displayed differently on different computers due
to different screen resolution.
The browser's back button might not work as the user hopes.
There are still few browsers that do not support frame technology.
Creating Frames
To use frames on a page we use <frameset> tag instead of <body> tag. The <frameset> tag
defines, how to divide the window into frames. The rows attribute of <frameset> tag
defines horizontal frames and cols attribute defines vertical frames. Each frame is indicated
by <frame> tag and it defines which HTML document shall open into the frame.
<frameset rows = "10%,80%,10%">
<frame name = "top" src = "/html/top_frame.htm" />
<frame name = "main" src = "/html/main_frame.htm" />
<frame name = "bottom" src = "/html/bottom_frame.htm" />
<noframes>
<body>Your browser does not support frames.</body>
</noframes>
</frameset>
The graphic to the left is created with <canvas>. It shows four elements: a red
rectangle, a gradient rectangle, a multicolor rectangle, and a multicolor text.
Canvas has several methods for drawing paths, boxes, circles, text, and adding images.
Canvas Examples
A canvas is a rectangular area on an HTML page. By default, a canvas has no border and
no content.
Circular Gradient
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
// Create gradient
var grd = ctx.createRadialGradient(75, 50, 5, 90, 60, 100);
grd.addColorStop(0, "red");
grd.addColorStop(1, "white");
// Fill with gradient
ctx.fillStyle = grd;
ctx.fillRect(10, 10, 150, 80);
</script>
For Image:
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
var img = document.getElementById("scream");
ctx.drawImage(img, 10, 10);
</script>
What is SVG?
SVG stands for Scalable Vector Graphics
SVG is used to define graphics for the Web
SVG is a W3C recommendation
SVG Circle
<!DOCTYPE html>
<html>
<body>
</body>
</html>
SVG Rectangle
<svg width="400" height="100">
<rect width="400" height="100" style="fill:rgb(0,0,255);stroke-width:10;
stroke:rgb(0,0,0) " />
</svg>
SVG Star
<svg width="300" height="200">
<polygon points="100,10 40,198 190,78 10,78 160,198"
style="fill:lime;stroke:purple;stroke-width:5;fill-rule:evenodd;" />
</svg>
<path d=…..>
M, L, V, H, C, S, Q, T, Z
- Absolute
m, l, v, h – relative
eg)
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
strokeWidth={1.5}
stroke="currentColor" className="w-6 h-6">
<path strokeLinecap="round"
strokeLinejoin="round"
d="M20.25 7.5l-.625 10.632a2.25 2.25 0 01-2.247 2.118H6.622a2.25 2.25 0 01-2.247-
2.118L3.75 7.5m6 4.125l2.25 2.25m0 0l2.25 2.25M12 13.875l2.25-2.25M12 13.875l-2.25
2.25M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-
1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125z" />
</svg>
HTML Layout
Special Tags
- <code> <kbd>
Semantic Tags – describes the meaning to both browser and developer
- Non semantic – div, span
- Semantic – Form, Table, List, article, all layout tags
HTML has several semantic elements that define the different parts of a web page:
That way the text size will follow the size of the browser window:
Hello World
Resize the browser window to see how the text size scales.
<code>
x = 5;
y = 6;
z = x + y;
</code>
The HTML <kbd> element is used to define keyboard input. The content inside is
displayed in the browser's default monospace font.
Examples of non-semantic elements: <div> and <span> - Tells nothing about its content.
Examples of semantic elements: <form>, <table>, and <article> - Clearly defines its content.
<nav>
<a href="/html/">HTML</a> |
<a href="/css/">CSS</a> |
<a href="/js/">JavaScript</a> |
<a href="/jquery/">jQuery</a>
</nav>
<p>My family and I visited The Epcot center this summer. The weather was
nice, and Epcot was amazing! I had a great summer together with my family!
</p>
<aside>
<h4>Epcot Center</h4>
<p>Epcot is a theme park at Walt Disney World Resort featuring exciting
attractions, international pavilions, award-winning fireworks and seasonal
special events.</p>
</aside>