Tags to:-
a. Change the body background:
The body can be changed to a color, image or even a gradient:
The background-color
property specifies the background color of an element.
Example
The background color of a page is set like this:
body {
background-color: lightblue;
}
With CSS, a color is most often specified by:
- a valid color name - like "red"
- a HEX value - like "#ff0000"
- an RGB value - like "rgb(255,0,0)"
CSS background-image
The background-image
property specifies an image to use as the background of an element.
By default, the image is repeated so it covers the entire element.
Example
Set the background image for a page:
body {
background-image: url("paper.gif");
}
b. Add image to an HTML page:
The HTML <img>
tag is used to embed an image in a web page.
Images are not technically inserted into a web page; images are linked to web pages. The <img>
tag creates a holding space for the referenced image.
The <img>
tag is empty, it contains attributes only, and does not have a closing tag.
The <img>
tag has two required attributes:
- src - Specifies the path to the image
- alt - Specifies an alternate text for the image
Example
<img src="WhyAreUrunning.jpg" alt="WhyAreU_dot_dot_dot.png">
c. Add video to an HTML page:
The HTML <video>
element is used to show a video on a web page.
Example
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
d. Add audio to an HTML page:
The <audio>
tag is used to embed sound content in a document, such as music or other audio streams.
The <audio>
tag contains one or more <source>
tags with different audio sources. The browser will choose the first source it supports.
The text between the <audio>
and </audio>
tags will only be displayed in browsers that do not support the <audio>
element.
There are three supported audio formats in HTML: MP3, WAV, and OGG.
Example
Play a sound file:
<audio controls>
<source src="NeverGonnaGiveYouUp.wav" type="audio/ogg">
<source src="RickAstley.mp3" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>