19 December 2016
Lecture 10: Displaying Images
Here is how we add an image in an webpage:
As you can see the tag we used is the img tag. The main attribute is the src attribute which contains the link of the image. The link can be relative or absolute.
The width and height attributes are optional, but useful because they help the browser know in advance what screen space should it allocate to the image. The alt tag is also optional. But should be included as it helps the screen readers and also this text will get displayed if the browser can't display the image (in case of a broken link).
The img is an inline element.
Lastly, we shall talk about the HTML comment. A comment will get ignored by the browser. We start the comment with <!-- and end with -->
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment