HTML q
Created By: chatGPT
In HTML, you can structure a webpage using various elements. The basic structure of an HTML document includes a declaration, head, and body.
<!DOCTYPE html>
<html>
<head>
<title>Your Page Title</title>
<meta charset="UTF-8">
</head>
<body>
<h1>Hello World!</h1>
<p>This is a paragraph.</p>
</body>
</html>
You can add links using the
<a>
tag. Attributes like href
define the destination of the link.<a href="https://www.example.com">Visit Example</a>
To include images, use the
<img>
tag with the src
attribute for the image source and the alt
attribute for an alternative text description.<img src="image.jpg" alt="Description of image">
For lists, HTML provides
<ul>
for unordered lists and <ol>
for ordered lists. Use <li>
to define list items.<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<ol>
<li>First Item</li>
<li>Second Item</li>
</ol>
You can create tables for organizing data using
<table>
, <tr>
for rows, <th>
for headers, and <td>
for data cells.<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table>
To add styles, you can use inline styles with the
style
attribute, or link an external stylesheet using the <link>
tag in the head section.<link rel="stylesheet" href="styles.css">
Forms are essential for user input. You can create a simple form with various input types such as text, password, email, etc.
<form action="submit.php" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name">
<input type="submit" value="Submit">
</form>