What is the primary function of attributes in an HTML document?
They provide additional information about HTML elements.
In which part of an HTML element must attributes always be defined?
Attributes are always defined in the opening tag of an element.
Attributes are always written in _____ pairs inside the opening tag of an element.
name-value
What is the recommended case for writing HTML attribute names and values?
It is recommended to write both attribute names and values in lowercase.
How should multiple attributes be separated within a single HTML element’s opening tag?
Multiple attributes must be separated by a space.
What is the function of the href attribute, typically used with anchor tags?
The href attribute defines the URL of the web page to which the link goes.
What information does the src attribute provide for an image element?
The src attribute provides the URL of the image to be embedded in the document.
Term: Absolute URL (in an src attribute)
Definition: A URL that points to an image hosted on an external website, providing the full web address.
Term: Relative URL (in an src attribute)
Definition: A URL that points to an image file located within the same system or website, providing a local path.
What is the main advantage of using relative URLs over absolute URLs for images?
Relative URLs are not dependent on an external source, which prevents broken images if the external source deletes the image.
What do the width and height attributes specify for an HTML image element?
They specify the width and height of an image, respectively, typically in pixels.
What is the purpose of the alt attribute in an <img> tag?
The alt attribute specifies alternate text for an image, which is displayed if the browser cannot render the image.
What does the dir attribute control in an HTML element?
The dir attribute determines the text direction of the element’s content.
The dir attribute can have three values: ltr, rtl, and _____.
auto
What is the default text direction for elements in HTML, corresponding to the ltr value?
The default text direction is left-to-right.
What is the function of the style attribute in an HTML element?
The style attribute allows you to write inline CSS to add styling to an element.
What is the purpose of the title attribute in an HTML element?
The title attribute defines extra information about an element, which appears as a tooltip on mouse-over.
What information is declared by the lang attribute in an HTML document?
The lang attribute is used to declare the language of the web page.
The lang attribute’s value often consists of two parts; what do they typically define?
The first two characters define the language, and the last two characters define the country.
What are the <h1> through <h6> tags used for in HTML?
They are used to define headings, with <h1> being the most important and <h6> being the least important.
Which heading tag is considered the most important and is typically displayed the largest by browsers?
The <h1> tag.
Which heading tag is considered the least important and is typically displayed the smallest by browsers?
The <h6> tag.
How do heading elements behave in the flow of an HTML document?
Heading elements are block-level elements, meaning each new heading starts on a new line.
Why are headings important for search engines?
Search engines use headings to index the structure and content of a webpage.
` tag in HTML?
` tag is used to define a paragraph of text.
` tag may work without a closing tag, what is the recommended best practice?
` tag?
` element in the source code?
` tag represent in HTML?
` tag represents preformatted text, where spaces and line breaks in the code are preserved in the output.
` tags is solved by using the `
` element?
` element solves the problem of browsers ignoring extra spaces and line breaks, making it easy to display multiline text.