Theory + Code Examples 💻
HTML is used to create structure of webpages.
<!DOCTYPE html> <html> <head> <title>My Page</title> </head> <body> Hello World </body> </html>
HTML elements contain tags and content.
<p>This is paragraph</p> <h1>Heading</h1>
<b>Bold</b> <i>Italic</i> <u>Underline</u>
<a href="https://google.com">Visit</a> <img src="image.jpg" alt="img">
<ul> <li>Item 1</li> <li>Item 2</li> </ul> <ol> <li>First</li> </ol>
<table border="1">
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>John</td>
<td>20</td>
</tr>
</table>
<form> <input type="text" placeholder="Name"> <input type="email"> <button>Submit</button> </form>
<header>Header</header> <nav>Menu</nav> <section>Content</section> <footer>Footer</footer>
<audio controls> <source src="song.mp3"> </audio> <video controls width="300"> <source src="video.mp4"> </video>
<script>
localStorage.setItem("name","Sasank");
console.log(localStorage.getItem("name"));
</script>
<canvas id="c" width="200" height="100"></canvas>
<script>
let c = document.getElementById("c");
let ctx = c.getContext("2d");
ctx.fillRect(20,20,100,50);
</script>
<!-- Use semantic tags --> <section> <h1>Title</h1> </section>