24 Computer -- Web Technology I

Write the tags to:a. Change the body background of an HTML document.b. Add image to an HTML page.c. Add video to an HTML page.d. Add audio to an HTML page.

Write the tags to:

a. Change the body background of an HTML document.

b. Add image to an HTML page.

c. Add video to an HTML page.

d. Add audio to an HTML page.

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>

More questions on Web Technology I

What is a link? Write the various ways of linking a document with another.

The link is a feature in HTML that allows the user to connect two webpages or documents.Alinkhas two ends -- calledanchors-- and a direction. The link starts at the "source" anchor and points to the "destination" anchor, which may be any Web resource (e.g., an image, a video clip, a sound bite, a program, an HTML document, an element within an HTML document, etc.).

HTML links are hyperlinks.

You can click on a link and jump to another document.

When you move the mouse over a link, the mouse...

Define table and write its tag.

he<table>tag defines an HTML table.

An HTML table consists of one<table>element and one or more<tr>,<th>, and<td>elements.

The <tr> element defines a table row, the <th> element defines a table header, and the <td> element defines a table cell.

An HTML table may also include<caption>,<colgroup>,<thead>,<tfoot>, and<tbody>elements.


Example

A simple HTML table, containing two columns and two rows:

<table>
<tr>
...
Close Open App