HTML Tags
Definition
- HTML tags are used to define the structure and content of a webpage.
Types of HTML Tags
(A) Start/Opening Tag & End/Closing Tag :
- Most of the HTML tags come in pairs like <h1> and </h1>, <body> and </body>, <head> and </head> and so many others. Here, <h1>, <body>, <head> etc. are start or opening tags whereas </h1>, </body>, </head> etc. are end or closing tags.
(B) Pair Tags & Unpair or Empty Tags :
Pair Tags :
-
- Those HTML tags which exist with opening and closing tags both are called Pair Tags.
- For example :- html, head, body, h1, h2, h3, h4, form, table etc.
Empty Tags/Self-Closing Tags :
-
- Those HTML tags which exist with an opening tag but without a closing tag are called Empty Tags.
- For example :- <br>, <img>, <input>, <link>, <meta>, <hr>,<param> etc.
HTML Attributes
Definition
- HTML attributes are used to provide additional information about an HTML element/tag.
Types
- For simplicity, we can categories the Html attributes in the following major group –
[A]Text Attributes
(a) Common Attributes: These are–
action, alt, background, background-color, background-image, background-position, background-repeat, background-size, behavior, charset, read-only, outline, box-shadow, class, text-indent, href, color, content, cursor, data, display, enctype, height, id, margin, method, name, padding, pattern, read-only, src, style, text-align, value, width, etc.
(b) Input Attributes: These are-
autocomplete, autofocus, border, checked, contenteditable, contextmenu, disabled, hidden, list, max, maxlength, min, multiple, placeholder, size, type, vertical-align etc.
(c) Table Attributes: These are–
align, bgcolor, border, bordercolor, cellpadding, cellspacing, cols, colspan, frame, hspace, rows, summary, title, vspace etc.
[B] Method Attributes
(a) Common Attributes: These are–
onBlur, onChange, onFocus, onInput, onReset, onSelect, onSubmit, etc.
(b) Mouse Attribute: These are–
onClick, onDblClick, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, etc.
(c) Key Attribute: These are–
onKeyDown, onKeyPress, onKeyUp, etc.
Common HTML Tags/Elements
Here are some of the most commonly used HTML tags:
<html>
– Defines the beginning and end of an HTML document.<head>
– Contains information about the document, such as the title and metadata.<title>
– Defines the title of the document that appears in the browser tab.<body>
– Contains the visible content of the document.<h1>
to<h6>
– Defines headings of different sizes.<p>
– Defines a paragraph.<a>
– Defines a hyperlink.<img>
– Displays an image.<ul>
– Defines an unordered list.<ol>
– Defines an ordered list.<li>
– Defines a list item.<table>
– Defines a table.<tr>
– Defines a table row.<td>
– Defines a table cell.<form>
– Defines a form for user input.<input>
– Defines an input field, such as a text box or a checkbox.<select>
– Defines a dropdown list.<option>
– Defines an option in a dropdown list.<button>
– Defines a clickable button.<div>
– Defines a section of the webpage that can be styled with CSS.
0 Comments