attributes Flashcards
1
Q
att
A
All HTML elements can have attributes
* Attributes provide additional information about
elements
* Attributes are always specified in the start tag
* Attributes usually come in name/value pairs
like: name=”value”
2
Q
href
A
The href Attribute
- The <a> tag defines a hyperlink. The href attribute specifies
the URL of the page the link goes to:</a>
Example
<a>Visit
W3Schools</a>
3
Q
src
A
The <img></img> tag is used to embed an image in an HTML page. The src
attribute specifies the path to the image to be displayed:
- Example
- <img></img>
4
Q
2 ways of specify src
A
absolute url
Links to an external image
that is hosted on another website.
- Example: src=”https://www.w3schools.com/images/img_girl.jpg”.
Relative URL - Links to an image that is
hosted within the website.
- Here, the URL does not include the domain name.
- If the URL begins without a slash, it will be relative to the current
page. - Example: src=”img_girl.jpg”. If the URL begins with a slash, it will be
relative to the domain. Example: src=”/images/img_girl.jpg”.
5
Q
style att
A
- The style attribute is used to add styles to an element, such as color,
font, size, and more. - Example
- <p>This is a red paragraph.</p>
6
Q
format
A
- Setting the style of an HTML element, can be done with the style
attribute. - The HTML style attribute has the following syntax:
- <tagname>
</tagname>