0
Img
How do I link a pic correctly using html
3 Answers
+ 2
Christianah Asieba Use the <img> html tag.
You will need to include some attributes with the tag.
đ src (required)
Absolutely required.
Gives the reference address for the image file.
Absolute reference for image file on different server than html file.
Local reference only for image file on same server as html file.
đ alt (required)
Required, though some are lazy and leave the value as empty quotes.
Text description of image in case it fails to load.
More important for screen readers for visually impaired users.
đ height, width
Optional but highly recommended.
Allows the browser to know how big the image will be before it finishes loading, so text is not jumping all over the place.
đ EXAMPLE - with absolute reference
<img src="https://www. example. com/pics/tree.jpg" alt="old oak tree" height="400" width="300">
+ 1
Christianah Asieba To actually imbed videos in your page, use BOTH <video> AND <source> tags, each with its own attributes.
<source> is nested inside open and close for <video>.
You can have multiple <source>. Browser will use first <source> supported.
đđ <video> attributes
đ height, width
Optional, but highly recommended.
Same reason to include as <img>.
đ controls, autoplay, muted, loop (Optional)
No value needed.
Just including them tells browser whether to include user controls, autoplay after loading, muted on start, or loop on end.
đđ <source> attributes
đ src (required)
Gives the reference address for the video file.
Absolute or local, same as for <img>.
đ type (required)
Gives the video format so browser can check if it can play it.
EXAMPLE
<video height="300" width="400" autoplay muted>
<source src="http://example .com/videos/kittens.mp4" type="video/mp4">
<source src="http://example .com/videos/puppies.ogg" type="video/ogg">
Text displayed if no sources supported.
</video>
0
Thanks do you know anything about videos