C) Write HTML Code For Creating A Table. Also Explain Table Element With Its Attributes
C) Write HTML Code For Creating A Table. Also Explain Table Element With Its Attributes
Also
explain table element with its attributes.
<!DOCTYPE html>
<html>
<head>
<title>Simple Table</title>
</head>
<body>
<table border="1">
<tr>
<th>Name</th>
<th>Subject</th>
<th>Marks</th>
</tr>
<tr>
<td>John</td>
<td>Math</td>
<td>90</td>
</tr>
<tr>
<td>Emma</td>
<td>Science</td>
<td>85</td>
</tr>
</table>
</body>
</html>
• <frameset> is used to divide the browser window into multiple sections (frames).
• It was used before in old websites, but now it's not used in modern HTML5 (it's
outdated).
What is <frame>?
<!DOCTYPE html>
<html>
<frameset cols="50%,50%">
<frame src="page1.html">
<frame src="page2.html">
</frameset>
</html>
<!DOCTYPE html>
<html>
<frameset rows="30%,70%">
<frame src="header.html">
<frame src="content.html">
</frameset>
</html>
Summary:
Tag Meaning
(i) Write any two meta tag syntax to implement different features in
HTML.
<meta charset="UTF-8">
Allows your webpage to show all types of characters (like English, Hindi, symbols, etc.)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<p>Hello World!</p>
</body>
</html>
Q.3 (b) What do you mean by meta tags? How can following be achieved using
metadata? a) Stop page from being listed b) Set expiration date c) Stop browser
from caching page ?
a) Stop page from being listed in search engines
Tells Google and other search engines NOT to show this page in search results.
Tells the browser that this page should not be used after this date/time.
Tells the browser not to save the page, so it always loads fresh content.
Without CSS:
With CSS:
• You can change colors, fonts, sizes, spacing, layout, and more.
2. Saves time
→ One CSS file can style many HTML pages.
5. Responsive design
→ CSS helps your site work well on phones, tablets, and desktops
Benefits of Bootstrap:
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Grid</title>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="row">
</div>
</div>
</body>
</html>
Explain following with example: <pre> tag, <sup> tag, character
encoding in HTML.
1. <pre> tag
What it does:
• It keeps the spaces, tabs, and line breaks exactly as you type them.
Example:
<pre>
This is text
with spaces
</pre>
Output:
This is text
with spaces
2. <sup> tag
What it does:
• The <sup> tag makes superscript text (text goes above the line).
Example:
<p>Area = a<sup>2</sup></p>
Output:
Area = a²
2 is in superscript form.
What it is:
Common encoding:
html
CopyEdit
<meta charset="UTF-8">
This is written inside <head> and supports almost all languages and symbols.
Example:
html
CopyEdit
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Character Encoding</title>
</head>
<body>
<p>Smile: </p>
<p>Rupee: ₹</p>
</body>
</html>
Without correct encoding, these might show as weird boxes or question marks (�)
1. <img> Tag
• The <img> tag is used to display images on a web page.
• You must use the src attribute (image path) and alt (alternative text).
Example:
html
CopyEdit