In HTML, elements are the building blocks that define the structure and content of a document. Elements are marked up using tags, and they can have attributes that provide additional information about the element.
Thank you for reading this post, don't forget to subscribe!Here are some commonly used HTML elements and attributes:
HTML Elements :
- Text Elements:
<p>: Paragraph<h1>,<h2>, …,<h6>: Headings<span>: Inline container for a small amount of text<br>: Line break<hr>: Horizontal rule
- List Elements:
<ul>: Unordered list<ol>: Ordered list<li>: List item
- Link Elements:
<a>: Anchor (used for hyperlinks)
- Image Element:
<img>: Image
- Form Elements:
<form>: Form container<input>: Input field<label>: Label for an input field<select>: Dropdown list<option>: Option within a select element<button>: Button
- Table Elements:
<table>: Table<tr>: Table row<th>: Table header cell<td>: Table data cell<thead>,<tbody>,<tfoot>: Table sections
- Semantic Elements (HTML5):
<article>,<section>,<nav>,<header>,<footer>,<aside>,<main>: Provide semantic meaning to different parts of the document.
HTML Attributes:
- Common Attributes:
id: Provides a unique identifier for an element.class: Specifies one or more class names for an element (used for styling with CSS).style: Inline styling for an element.
- Link Attributes:
href: Specifies the URL of a linked resource (used with<a>and<link>).target: Specifies where to open the linked resource (_blankfor a new tab, etc.).
- Image Attributes:
src: Specifies the source URL of an image.alt: Provides alternative text for screen readers and if the image fails to load.
- Form Attributes:
action: Specifies the URL to which form data is sent.method: Specifies the HTTP method for form submission (GETorPOST).
- Input Attributes:
type: Specifies the type of input (e.g., text, checkbox, radio).name: Specifies the name of the input field.
- Table Attributes:
colspan: Specifies the number of columns a table cell should span.rowspan: Specifies the number of rows a table cell should span.
- Meta Attributes:
charset: Specifies the character encoding for the document.content: Provides metadata content (used with<meta>).