HTML Assignment Solutions
HTML Heading
<h1>This is a Heading</h1>
HTML Paragraph
<p>This is a paragraph.</p>
HTML Link
<a href="https://www.example.com">This is a link</a>
Ordered List
<ol><li>Item 1</li><li>Item 2</li><li>Item 3</li></ol>
Unordered List
<ul><li>Item A</li><li>Item B</li><li>Item C</li></ul>
HTML Table
<table border="1">
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table>
HTML Style
<p style="color:blue;">This is a styled paragraph.</p>
HTML Image (Floating)
<img src="image.jpg" alt="Image" style="float:right;width:100px;height:100px;">
HTML Form
<form action="/submit">
<label for="name">Name:</label><br>
<input type="text" id="name" name="name"><br>
<input type="submit" value="Submit">
</form>
HTML Audio/Video
<audio controls>
<source src="audio.mp3" type="audio/mpeg">
</audio>
<br>
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
</video>
YouTube Hyperlink
<a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ">Watch this YouTube
video</a>
HTML API (Drag and Drop)
<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)">
<img id="drag1" src="image.jpg" draggable="true" ondragstart="drag(event)"
width="88" height="31">
</div>
<script>
function allowDrop(ev) {
ev.preventDefault();
}
function drag(ev) {
ev.dataTransfer.setData("text", ev.target.id);
}
function drop(ev) {
ev.preventDefault();
var data = ev.dataTransfer.getData("text");
ev.target.appendChild(document.getElementById(data));
}
</script>
HTML Semantic Elements
<header>
<h1>Welcome to My Website</h1>
</header>
<nav>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
</nav>
<article>
<h2>Main Content</h2>
<p>This is the main content of the page.</p>
</article>
<footer>
<p>Footer content here.</p>
</footer>