#stillonhtml
Explore tagged Tumblr posts
mydigitalweblog · 5 years ago
Text
How to add links and images in html
Today’s post is about links and images in html 🙌🏽🙌🏽🙌🏽Do you know the importance of links and images on a website? So let’s get straight to the point.
Links are created using <a></a> element, and the landing place of the link is controlled by an href attribute. This href is an hyperlink reference. There are two types of URL, the absolute and relative URL. An absolute URL is the entire address from the protocol (https) to the domain name (www.google.com). Basically, it's the full URL of the page that you link to. The relative URL, on the other hand, does not use the full web address and only contains the location following the domain. It assumes that the link you add is on the same site and is part of the same root domain. The relative path starts with the forward slash and leads the browser to stay within the current site. I also found out that a target attribute is used with a blank value as: <a href="https://google.com" target="_blank">Google</a>, in order for the URL to open in a new tab, so that users will not leave the website to another website, and this is mostly done when a link directs you to an external website.
Tumblr media
Images are represented by <img> together with the source. For example, <img src =“boy.jpg”>, which shows that the image file is in the same location as the html file, but if the file is in a subfolder (e.g. images), then it will be <img src=“images/boy.jpg”>, and the alt attribute comes in as <img src=“images”/boy.jpg”alt=“A Boy”>. The alt attribute specifies an alternate text for the image, peradventure the image cannot be displayed. The alt attribute provides alternative information for the image, and if a user for some reason cannot view it (because of slow connection, an error in the src attribute, or if the user uses a screen reader. The alt attribute is basically for visual reason. You can also wrap images inside figure elements, and a figcaption is placed inside the figure element, and what it does is to give caption to images.
Tumblr media
14 notes · View notes