Course Content
Web Scraping with Python
Web Scraping with Python
HTML Attributes
If you wish to include additional information about HTML
elements, you should employ attributes. Attributes must be specified within an opening tag, typically in pairs: name="value"
.
For example, when you want to embed an image, you should utilize the <img>
tag with the src
attribute. The value of this attribute should be the link to the image.
For instance:
This code will display the following image. Note that the <img>
tag is self-closing, meaning it doesn't require a closing tag.
Another commonly used tag that always includes an attribute is the anchor <a>
tag. It is used to create hyperlinks, and you must specify the link destination within the href attribute. For example:
will return Test page.
There we also set the target
parameter to '_blank'
so that pressing on the link will open the page in a new tab.
Thanks for your feedback!