Home › Forums › Web Design › HTML › What are HTML codes
- This topic is empty.
-
CreatorTopic
-
July 18, 2024 at 10:42 am #6321::
HTML codes, also known as HTML elements or tags, are the building blocks of web pages. They are used to structure content and define the elements that appear on a webpage. HTML (HyperText Markup Language) uses a series of predefined tags to format text, embed images, create links, build tables, and more. Here are some common HTML codes (tags) and their purposes:
- Basic Structure Tags:
html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Page Title</title>
</head>
<body>
<!-- Content goes here -->
</body>
</html>
<!DOCTYPE html>
: Specifies the HTML5 document type.<html>
: Defines the root element of an HTML page.<head>
: Contains meta-information about the document.<meta charset="UTF-8">
: Specifies the character encoding for the document.<title>
: Sets the title of the webpage displayed in the browser tab.<body>
: Contains the visible content of the webpage.
- Text Formatting Tags:
html
<h1>Heading 1</h1>
<p>This is a paragraph.</p>
<strong>Strong emphasis</strong>
<em>Italic emphasis</em>
<h1>
to<h6>
: Defines headings of different levels.<p>
: Defines a paragraph.<strong>
: Represents text with strong importance.<em>
: Represents emphasized text.
- Links and Images:
html
<a href="https://example.com">Link to Example</a>
<img src="image.jpg" alt="Description of image">
<a>
: Defines a hyperlink.href="..."
: Specifies the URL that the link points to.<img>
: Embeds an image in the webpage.src="..."
: Specifies the URL of the image.alt="..."
: Provides alternative text for the image (important for accessibility).
- Lists:
html
<ul>
<li>Unordered list item</li>
<li>Another item</li>
</ul><ol>
<li>Ordered list item</li>
<li>Another item</li>
</ol>
<ul>
: Defines an unordered (bulleted) list.<ol>
: Defines an ordered (numbered) list.<li>
: Defines list items.
- Tables:
html
<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Row 1, Cell 1</td>
<td>Row 1, Cell 2</td>
</tr>
</table>
<table>
: Defines a table.<tr>
: Defines a row in the table.<th>
: Defines a header cell in the table.<td>
: Defines a standard cell in the table.
- Forms:
html
<form action="/submit-form" method="post">
<label for="username">Username:</label>
<input type="text" id="username" name="username">
<br>
<label for="password">Password:</label>
<input type="password" id="password" name="password">
<br>
<input type="submit" value="Submit">
</form>
<form>
: Defines an HTML form for user input.action="..."
: Specifies where to send the form data when submitted.method="post"
: Specifies the HTTP method (post or get) for sending form data.<label>
: Defines a label for an input element.<input>
: Defines an input control (text, password, submit button, etc.).
These are just a few examples of HTML tags commonly used to create and structure content on web pages. HTML is a versatile language with many more tags and attributes available.
- Basic Structure Tags:
-
CreatorTopic
- You must be logged in to reply to this topic.