Podcast
Questions and Answers
What is the purpose of the 'align' attribute in HTML?
What is the purpose of the 'align' attribute in HTML?
What is the default alignment of HTML paragraphs?
What is the default alignment of HTML paragraphs?
Which HTML element requires the 'src' attribute to function as intended?
Which HTML element requires the 'src' attribute to function as intended?
What does the 'controls' attribute do in the element?
What does the 'controls' attribute do in the element?
Signup and view all the answers
Which of the following HTML elements uses the 'src' attribute?
Which of the following HTML elements uses the 'src' attribute?
Signup and view all the answers
What determines the size of a video on a webpage?
What determines the size of a video on a webpage?
Signup and view all the answers
What is the purpose of the 'target' attribute in HTML anchor tags?
What is the purpose of the 'target' attribute in HTML anchor tags?
Signup and view all the answers
What is the format of an absolute URL?
What is the format of an absolute URL?
Signup and view all the answers
What is the purpose of the anchor tag in HTML?
What is the purpose of the anchor tag in HTML?
Signup and view all the answers
What is the default behavior of the 'target' attribute in HTML anchor tags?
What is the default behavior of the 'target' attribute in HTML anchor tags?
Signup and view all the answers
What is the difference between an absolute URL and a relative URL?
What is the difference between an absolute URL and a relative URL?
Signup and view all the answers
What happens when you hover over a hyperlink?
What happens when you hover over a hyperlink?
Signup and view all the answers
Study Notes
HTML Attributes
- HTML attributes define additional properties to HTML elements.
- Attributes are written inside the start tag with attribute-value pairs (attribute=value).
- Attributes are normally optional for many HTML tags, but some elements require attributes to function correctly.
HTML Elements Requiring Attributes
- The `` element requires the "src" attribute, which refers to the image file name and location.
- The `` element also uses the "src" attribute, which refers to the video file name.
Video Element Attributes
- The "controls" attribute adds play, pause, and volume controls to the video; no value is assigned to this attribute.
- The "width" and "height" attributes control the video size on the webpage, depending on the assigned value.
- The "src" attribute in the `` element refers to the video file name.
HTML Links
- HTML links are used to navigate between webpages or within a webpage and can be in the form of text or images, also known as hyperlinks.
- Hyperlinks are distinguished by the hand symbol that the mouse cursor changes to when hovering over them.
Creating Hyperlinks
- The anchor tag
<a>
is used to create hyperlinks in HTML. - The format of an HTML element formed from an anchor tag includes an opening
</a><a>
tag, the link text or image, and a closing</a>
tag.
Target Attribute
- The "target" attribute determines where the linked document is displayed.
- The "target" attribute has the following values:
-
_self
: Displays the webpage in the same window/tab (default). -
_blank
: Displays the webpage in a separate window/tab.
Image Element and URLs
- The image element is placed between
and
tags. - A relative URL is used to reference an image, assuming the image and webpage are in the same folder.
- There are two types of URLs:
-
Absolute URL : Includes every element of a URL (protocol, hostname, and path), e.g.,
<a href="http://www.somewebsite.com/somefile.html">http://www.somewebsite.com/somefile.html</a>
. -
Relative URL : A path given relative to the current webpage's location, e.g.,
somedirectory/somefile.html
.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Learn about HTML attributes and how to use them to define additional properties to HTML elements. Understand how to align texts and customize tags.