1.
Basic tags
<html>
<head>
<title>My Basic Web Page</title>
</head>
<body>
<h1>Welcome to My Web Page</h1>
<p>This is a simple HTML page using only basic tags.</p>
<h2>My Favorite Image</h2>
<img src="[Link] alt="Sample Image">
<h2>My Hobbies</h2>
<ul>
<li>Reading books</li>
<li>Listening to music</li>
<li>Exploring nature</li>
</ul>
<h2>Quote</h2>
<p>"The best way to predict the future is to invent it." - Alan Kay</p>
<h2>Contact Info</h2>
<p>Email: someone@[Link]</p>
<p>Phone: 123-456-7890</p>
<h2>Visit My Favorite Website</h2>
<p><a href="[Link] target="_blank">Click here to
visit Wikipedia</a></p>
<p>© 2025 My Website</p>
</body>
</html>
[Link]
<html>
<head>
<title>Simple HTML Table</title>
</head>
<body>
<h1>Exam Results</h1>
<table border="1">
<tr>
<th rowspan="2">Roll No</th>
<th rowspan="2">Name</th>
<th colspan="2">Marks</th>
</tr>
<tr>
<th>Math</th>
<th>Science</th>
</tr>
<tr>
<td>1</td>
<td>Aarav</td>
<td>85</td>
<td>90</td>
</tr>
<tr>
<td>2</td>
<td>Meera</td>
<td>92</td>
<td>88</td>
</tr>
<tr>
<td>3</td>
<td>Ravi</td>
<td>75</td>
<td>80</td>
</tr>
</table>
</body>
</html>
[Link]
<html>
<head>
<title>Registration Form</title>
</head>
<body>
<h1>User Registration Form</h1>
<form action="[Link]" method="post">
<p>
Full Name: <br>
<input type="text" name="fullname" id="fullname" placeholder="Enter
your full name" required maxlength="50">
</p>
<p>
Email: <br>
<input type="email" name="email" id="email"
placeholder="example@[Link]" required>
</p>
<p>
Password: <br>
<input type="password" name="password" id="password" required
minlength="6" maxlength="20">
</p>
<p>
Age: <br>
<input type="number" name="age" id="age" min="1" max="120"
value="18">
</p>
<p>
Gender: <br>
<input type="radio" name="gender" value="male" checked> Male<br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="other"> Other
</p>
<p>
Hobbies: <br>
<input type="checkbox" name="hobby1" value="reading" checked>
Reading<br>
<input type="checkbox" name="hobby2" value="sports"> Sports<br>
<input type="checkbox" name="hobby3" value="music" disabled>
Music (Disabled)
</p>
<p>
Country: <br>
<select name="country" required>
<option value="">--Select--</option>
<option value="india" selected>India</option>
<option value="usa">USA</option>
<option value="uk">UK</option>
</select>
</p>
<p>
Bio: <br>
<textarea name="bio" rows="4" cols="40" placeholder="Write about
yourself..."></textarea>
</p>
<p>
Read-only Info: <br>
<input type="text" value="Form Version 1.0" readonly>
</p>
<p>
<input type="submit" value="Register">
<input type="reset" value="Clear">
</p>
</form>
</body>
</html>
[Link] using CSS
(Internal)
<html>
<head>
<title>Styled Web Page</title>
<style>
body {
background-color: #f2f2f2;
font-family: Arial, sans-serif;
color: #333;
padding: 20px;
}
h1 {
color: #004080;
text-align: center;
}
p{
font-size: 16px;
line-height: 1.6;
}
.highlight {
background-color: yellow;
font-weight: bold;
}
ul {
background-color: #fff;
padding: 10px;
border: 1px solid #ccc;
width: 250px;
}
li {
margin-bottom: 5px;
}
a{
color: #0066cc;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<h1>Welcome to My Web Page</h1>
<p>This is a sample webpage with <span class="highlight">internal
CSS</span> applied.</p>
<h2>Most Used Websites</h2>
<ul>
<li><a href="[Link] target="_blank">Google</a></li>
<li><a href="[Link]
target="_blank">Wikipedia</a></li>
<li><a href="[Link] target="_blank">GitHub</a></li>
</ul>
</body>
</html>
(External)
[Link] file
<html>
<head>
<title>Web Page with External CSS</title>
<!-- Link to external CSS file -->
<link rel="stylesheet" type="text/css" href="[Link]">
</head>
<body>
<h1>Welcome to My Web Page</h1>
<p>This is a sample webpage using <span class="highlight">external
CSS</span>.</p>
<h2>My Favorite Websites</h2>
<ul>
<li><a href="[Link] target="_blank">Google</a></li>
<li><a href="[Link]
target="_blank">Wikipedia</a></li>
<li><a href="[Link] target="_blank">GitHub</a></li>
</ul>
</body>
</html>
[Link] file
body {
background-color: #f9f9f9;
font-family: Verdana, sans-serif;
color: #333;
padding: 20px;
}
h1 {
color: #0066cc;
text-align: center;
}
p{
font-size: 16px;
line-height: 1.6;
}
.highlight {
background-color: yellow;
font-weight: bold;
}
ul {
background-color: #fff;
padding: 10px;
border: 1px solid #ccc;
width: 250px;
}
li {
margin-bottom: 5px;
}
a{
color: #003366;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
[Link]
<html>
<head>
<title>Interactive Web Page</title>
<script>
[Link] = function() {
alert("Welcome to the Interactive Web Page!");
};
function greetUser() {
const name = prompt("What's your name?");
if (name) {
[Link]("greeting").innerHTML = "Hello, " + name +
"! Nice to see you here.";
}
}
function showTime() {
const now = new Date();
[Link]("time").innerHTML = "Current Time: " +
[Link]();
}
function changeColor() {
const colors = ["#fce4ec", "#e0f7fa", "#fff9c4", "#f3e5f5", "#e8f5e9"];
const randomColor = colors[[Link]([Link]() * [Link])];
[Link] = randomColor;
}
setInterval(showTime, 1000);
</script>
</head>
<body>
<h1> My JavaScript Web Page</h1>
<p id="greeting">Click the button below to get a greeting!</p>
<button onclick="greetUser()">Greet Me</button>
<hr>
<h2> Live Time Display</h2>
<p id="time">Loading time...</p>
<hr>
<h2> Make It Colorful</h2>
<p>Click the button to change the background color randomly:</p>
<button onclick="changeColor()">Change Background Color</button>
<hr>
<h2> About This Page</h2>
<p>This page is made using basic HTML and JavaScript. It
demonstrates:</p>
<ul>
<li>JavaScript alerts and prompts</li>
<li>Dynamic content updates</li>
<li>Live clock using setInterval</li>
<li>Random background color changer</li>
</ul>
<hr>
<footer>
<p> Created by Nishant — Powered by JavaScript</p>
</footer>
</body>
</html>
[Link]
[Link]
<html>
<head>
<title>Book Library from XML</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
padding: 20px;
}
h1 {
color: #333;
}
.book {
background: #fff;
padding: 10px;
margin-bottom: 10px;
border-radius: 5px;
box-shadow: 0 0 5px rgba(0,0,0,0.1);
}
</style>
<script>
function loadXML() {
const xhttp = new XMLHttpRequest();
[Link] = function () {
if ([Link] === 4 && [Link] === 200) {
const xmlDoc = [Link];
const books = [Link]("book");
let output = "<h2>Book List</h2>";
for (let i = 0; i < [Link]; i++) {
const title = books[i].getElementsByTagName("title")[0].textContent;
const author =
books[i].getElementsByTagName("author")[0].textContent;
const year = books[i].getElementsByTagName("year")[0].textContent;
output += `
<div class="book">
<strong>${title}</strong><br>
Author: ${author}<br>
Published: ${year}
</div>`;
}
[Link]("output").innerHTML = output;
}
};
[Link]("GET", "[Link]", true);
[Link]();
}
</script>
</head>
<body onload="loadXML()">
<h1> XML Book Library (Offline)</h1>
<div id="output">Loading books from XML...</div>
</body>
</html>
Xml file
<?xml version="1.0" encoding="UTF-8"?>
<library>
<book>
<title>The Alchemist</title>
<author>Paulo Coelho</author>
<year>1988</year>
</book>
<book>
<title>Clean Code</title>
<author>Robert C. Martin</author>
<year>2008</year>
</book>
<book>
<title>The Hobbit</title>
<author>J.R.R. Tolkien</author>
<year>1937</year>
</book>
</library>
[Link] Xml file
[Link]
<?xml version="1.0" encoding="UTF-8"?>
<library xmlns:xsi="[Link]
xsi:noNamespaceSchemaLocation="[Link]">
<book>
<title>The Alchemist</title>
<author>Paulo Coelho</author>
<year>1988</year>
</book>
<book>
<title>1984</title>
<author>George Orwell</author>
<year>1949</year>
</book>
</library>
[Link]
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="[Link]
<xs:element name="library">
<xs:complexType>
<xs:sequence>
<xs:element name="book" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="author" type="xs:string"/>
<xs:element name="year" type="xs:gYear"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
[Link] schema
[Link]
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="[Link]"?>
<library xmlns:xsi="[Link]
xsi:noNamespaceSchemaLocation="[Link]">
<book>
<title>The Alchemist</title>
<author>Paulo Coelho</author>
<year>1988</year>
</book>
<book>
<title>Clean Code</title>
<author>Robert C. Martin</author>
<year>2008</year>
</book>
<book>
<title>The Hobbit</title>
<author>J.R.R. Tolkien</author>
<year>1937</year>
</book>
</library>
[Link]
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="[Link]
<xs:element name="library">
<xs:complexType>
<xs:sequence>
<xs:element name="book" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string"/>
<xs:element name="author" type="xs:string"/>
<xs:element name="year" type="xs:gYear"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
[Link]
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="[Link]
version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:template match="/">
<html>
<head>
<title>My Book Library</title>
<link rel="stylesheet" href="[Link]"/>
</head>
<body>
<h1> Book List from XML</h1>
<div class="library">
<xsl:for-each select="library/book">
<div class="book">
<h2><xsl:value-of select="title"/></h2>
<p><strong>Author:</strong> <xsl:value-of select="author"/></p>
<p><strong>Year:</strong> <xsl:value-of select="year"/></p>
</div>
</xsl:for-each>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
[Link]
<html>
<head>
<meta http-equiv="refresh" content="0; URL=[Link]" />
</head>
<body>
<p>If you're not redirected, <a href="[Link]">click here to view the
XML page</a>.</p>
</body>
</html>
[Link]
body {
font-family: Arial, sans-serif;
background-color: #f4f7f9;
padding: 20px;
}
h1 {
color: #333;
}
.book {
background-color: white;
border-left: 5px solid #4CAF50;
margin-bottom: 15px;
padding: 15px;
border-radius: 5px;
box-shadow: 0 0 5px rgba(0,0,0,0.1);
}
.book h2 {
margin: 0;
color: #4CAF50;
}
[Link]
<html>
<head>
<title>Login Page</title>
</head>
<body>
<h2>Login Form</h2>
<form>
<label for="username">Username:</label><br>
<input type="text" id="username" name="username"><br><br>
<label for="password">Password:</label><br>
<input type="password" id="password" name="password"><br><br>
<input type="submit" value="Login">
</form>
</body>
</html>
[Link]
[Link]
<html>
<head>
<title>Message</title>
</head>
<body>
<h2>Hello from Java Program!</h2>
</body>
</html>
[Link]
import [Link];
import [Link];
import [Link];
public class OpenHTML {
public static void main(String[] args) {
try {
File htmlFile = new File("[Link]"); // Make sure the path is
correct
if ([Link]()) {
[Link]().browse([Link]());
} else {
[Link]("File not found.");
}
} catch (IOException e) {
[Link]();
}
}
}