images and attributes Flashcards
img
The <img></img> element is a special element, and that’s because it doesn’t have any content, and therefore it also doesn’t have a closing tag.
Attributes
attributes are basically pieces of data(information) which provide additional information about HTML elements : They Define additional characteristics or properties of the element.; control the behavior of the element.
src
Is describing the source from which the browser should basically read the image.
Alt
Alternative text; some text that should describe what the image is about.
this is very important for various reasons:
- One of them is that it will allow search engines, such as Google Chrome, to actually know what is in the image, because without this description, search engines don’t really have a know of knowing what the image is actually about.
-And second, and probably even more important, is that by specifying the description of the image, we can also allow blind people to use a website. So users who use a screen reader will not see the image, but instead they will have the screen reader read the alternative text, so the description to them. So never skip this attribute.
img warning
width and height : Be careful with the use of width and height.
To crop images : Use online tools or software.
💡 We did not specify the image using some content in this element. Instead, what we needed to do was to specify an attribute.