Web Development Fundamentals - Learn HTML - Elements Cheatsheet - Codecademy
Web Development Fundamentals - Learn HTML - Elements Cheatsheet - Codecademy
HTML Element
An HTML element is a piece of content in an HTML
document and uses the following syntax: opening tag + <p>Hello World!</p>
content + closing tag. In the code provided:
HTML Tag
The syntax for a single HTML tag is an opening angle
bracket < followed by the element name and a closing <div>
angle bracket > . Here is an example of an opening
<div> tag.
Element Content
The content of an HTML element is the information
between the opening and closing tags of an element. <h1>Codecademy is awesome! 🙂</h1>
Closing Tag
An HTML closing tag is used to denote the end of an
HTML element. The syntax for a closing tag is a left angle <body>
document.
</body>
HTML Structure
HTML is organized into a family tree structure. HTML
elements can have parents, grandparents, siblings, <body>
</div>
</body>
...
<div> elements can contain flow content such as <h1>A section of grouped elements</h1>
headings, paragraphs, links, images, etc. <p>Here’s some text for the section</p>
</div>
<div>
</div>
HTML Attributes
HTML attributes are values added to the opening tag of an
element to configure the element or change the <p id="my-paragraph" style="color:
element’s default behavior. In the provided example, we green;">Here’s some text for a paragraph
are giving the <p> (paragraph) element a unique that is being altered by HTML
identifier using the id attribute and changing the color attributes</p>
of the default text using the style attribute.
required, like in a postal address. The line break element Poems are a great use case.<br>
requires only an opening tag and must not have a closing Oh joy! A line break.
tag.
<ul> Unordered List Element
The <ul> unordered list element is used to create a list
of items in no particular order. Each individual list item <ul>
</ul>
<ul>
<li>Cookies</li>
<li>Milk</li>
</ul>
</ol>
alt Attribute
An <img> element can have alternative text via the alt
attribute. The alternative text will be displayed if an image <img src="path/to/image" alt="text
fails to render due to an incorrect URL, if the image describing image" />
format is not supported by the browser, if the image is
blocked from being displayed, or if the image has not
been received from the URL.
The text will be read aloud if screen reading software is
used and helps support visually impaired users by
providing a text descriptor for the image content on a
webpage.
<video> Video Element
The <video> element embeds a media player for video
playback. The src attribute will contain the URL to the <video src="test-video.mp4" controls>
video. Adding the controls attribute will display video Video not supported