Internet Technology and Web Design Chapter 09 HTML Programming Basics Notes Set 02

Download Computer Science Useful Resources

Explore structured advanced study materials through the Internet Technology and Web Design Chapter 09 HTML Programming Basics Notes Set 02. Tailored for learners, utilizing these Computer Science resources ensures thorough preparation and strengthens foundational knowledge before final evaluations.

Access Study Guides and Summaries

Access the complete useful resource PDF for Computer Science below. Regular practice with these targeted academic notes builds familiarity with complex topics and helps secure higher marks in final school evaluations.

This page covers hyperlinks and the link syntax with href, target and id, the three kinds of HTML lists, the HTML table model with its collections, methods and properties, and frames and framesets with their attributes and link targets. It also explains HTML forms and their input controls, inserting and sizing images with the img tag, multimedia and the common video and sound formats, and ends with practice exercises and a chapter summary.

HTML Links

1. The HTML <a> tag defines a hyperlink.
2. An anchor tag (a) is used to define a link, but you also need to add something to the anchor tag – the destination of the link.
3. A hyperlink (or link) is a word, group of words, or image that you can click on to jump to another document.
4. When you move the cursor over a link in a Web page, the arrow will turn into a little hand.
5. The most important attribute of the <a> element is the href attribute, which indicates the link's destination.
6. By default, links will appear as follows in all browsers,

1. An unvisited link is underlined and blue.
2. A visited link is underlined and purple.
3. An active link is underlined and red.

HTML Link Syntax

The HTML code for a link is simple. It looks like this,

<a href="url">Link text</a>

The href attribute specifies the destination of a link.

HTML Links – The target Attribute

The target attribute specifies where to open the linked document.

HTML Links – The id Attribute

1. The id attribute can be used to create a bookmark inside a HTML document.
2. Bookmarks are not displayed in any special way. They are invisible to the reader.

Example

<!DOCTYPE html>

<html>

<head>
    <title>My first web page</title>
</head>

<body>

    <h1>My first web page</h1>

    <h2>What this is</h2>
    <p>A simple page put together using HTML</p>

    <h2>Why this is</h2>
    <p>To learn HTML</p>

    <h2>Where to find the tutorial</h2>
    <p><a href="http://www.htmldog.com">HTML Dog</a></p>

</body>

</html>

HTML Lists

1. A list is any ordered set of data. HTML offers us several mechanisms for specifying lists of information.
2. Lists are a part of everyday life. To-do lists determine what to get done.
3. Navigational routes provide turn-by-turn lists of directions. Recipes provide lists of ingredients and lists of instructions.
4. With a list for nearly everything, it’s easy to understand why they are also popular online.
5. When we want to use a list on a website, HTML provides three different types to choose from: Unordered List, Ordered List and Description List.
6. Choosing which type of list to use or whether to use a list at all comes down to the content and the most semantically appropriate option for displaying that content.
7. For example, we can choose what type of marker to use on a list. The marker could be square, round, numeric, alphabetical, or perhaps nonexistent.
8. Also, we can decide if a list should be displayed vertically or horizontally. All of these choices play significant roles in the styling of our web pages.

Unordered List

1. An unordered list is simply a list of related items whose order does not matter.
2. Creating an unordered list in HTML is accomplished using the unordered list block-level element, <ul>.
3. Each item within an unordered list is individually marked up using the list item element, <li>.
4. By default, most browsers add a vertical margin and left padding to the <ul> element and precede each <li> element with a solid dot.

Example program

<ul>
  <li>Orange</li>
  <li>Green</li>
  <li>Blue</li>
</ul>

Output: The three items Orange, Green and Blue are shown one below the other, each with a solid dot in front.

Ordered List

1. The ordered list element, <ol>, works very much like the unordered list element; individual list items are created in the same manner.
2. The main difference between an ordered list and an unordered list is that with an ordered list, the order in which items are presented is important.
3. Because the order matters, instead of using a dot as the default list item marker, an ordered list uses numbers.

Example Program

<ol>
  <li>Head north on N Halsted St</li>
  <li>Turn right on W Diversey Pkwy</li>
  <li>Turn left on N Orchard St</li>
</ol>

Output: The three directions are shown numbered 1, 2 and 3.

Description List

1. Another type of list seen online (but not as often as unordered or ordered lists) is the description list.
2. Description lists are used to outline multiple terms and their descriptions, as in a glossary.
3. Creating a description list in HTML is accomplished using the description list block-level element, <dl>.
4. Instead of using a <li> element to mark up list items, the description list requires two block-level elements the description term element, <dt>, and the description element, <dd>.
5. A description list may contain numerous terms and descriptions, one after the other.
6. Additionally, a description list may have multiple terms per description, as well as multiple descriptions per term.
7. A single term may have multiple meanings and warrant multiple descriptions.
8. Conversely, a single description may be suitable for multiple terms.
9. When adding a description list, the <dt> element must come before the <dd> element.
10. The definition term and the description that directly follows it correspond to one another thus, the order of these elements is important.
11. By default, the <dl> element will include vertical margins, just like the <ul> and <ol> elements.
12. Additionally, the <dd> element includes a left margin by default.

HTML Document Tables

1. The HTML table model allows authors to arrange data -- text, pre-formatted text, images, links, forms, form fields, other tables, etc. -- into rows and columns of cells.
2. The table object represents an HTML <table> element.
3. Each table may have an associated caption that provides a short description of the table's purpose.
4. Table rows may be grouped into a head, foot, and body sections, (via the THEAD, TFOOT AND TBODY elements, respectively).
5. Row groups convey additional structural information and may be rendered by user agents in ways that emphasize this structure.
6. User agents may exploit the head/body/foot division to support scrolling of body sections independently of the head and foot sections.
7. When long tables are printed, the head and foot information may be repeated on each page that contains table data.
8. Authors may also group columns to provide additional structural information that may be exploited by user agents.
9. Furthermore, authors may declare column properties at the start of a table definition in a way that enables user agents to render the table incrementally rather than having to wait for all the table data to arrive before rendering.
10. Table cells may either contain "header" information or "data". Cells may span multiple rows and columns.
11. The HTML 4th table model allows authors to label each cell so that non-visual user agents may more easily communicate heading information about the cell to the user.
12. Not only do these mechanisms greatly assist users with visual disabilities, they make it possible for multi-model wireless browsers with limited display capabilities (e.g., Web-enabled pagers and phones) to handle tables.
13. Tables should not be used purely as a means to layout document content as this may present problems when rendering to non-visual media.
14. Additionally, when used with graphics, these tables may force users to scroll horizontally to view a table designed on a system with a larger display.
15. To minimize these problems, authors should use style sheets to control layout rather than tables.

Access a Table object

User can access a <table> element by using getElementById().

var x = document.getElementById("myTable");

Create a Table object

User can create a <table> element by using the document.createElement() method.

var x = document.createElement("TABLE");

Table object Collections

CollectionDescription
cellsReturns a collection of all <td> or <th> elements in a table
rowsReturns a collection of all <tr> elements in a table
tBodiesReturns a collection of all <tbody> elements in a table

FIG 9.8: Table object collection

Table Object Methods

MethodDescription
createCaption()Creates an empty <caption> element and adds it to the table
createTFoot()Creates an empty <tfoot> element and adds it to the table
createTHead()Creates an empty <thead> element and adds it to the table
deleteCaption()Removes the first <caption> element from the table
deleteRow()Removes a row (<tr>) from the table
deleteTFoot()Removes the <tfoot> element from the table
deleteTHead()Removes the <thead> element from the table
insertRow()Creates an empty <tr> element and adds it to the table

FIG 9.9: Table object methods

Table object Properties

PropertyDescription
AlignSets or returns the alignment of a table according to surrounding text
BackgroundSets or returns the background image of a table
BgcolorSets or returns the background color of a table
BorderSets or returns the width of the table border
CaptionReturns the <caption> element of a table
CellpaddingSets or returns the amount of space between the cell border and cell content
CellspacingSets or returns the amount of space between the cells in a table
FrameSets or returns which outer borders (of a table) that should be displayed
HeightSets or returns the height of the table
RulesSets or returns which inner borders (between the cells) that should be displayed in a table
SummarySets or returns a description of the data in a table.
TfootReturns a reference to the <tfoot> element of a table
TheadReturns a reference to the <thead> element of a table
WidthSets or returns the width of the table

FIG 9.10: Table object property

HTML Frames

1. Frame is a typical layout on the web page by which a user can interact with the web page.
2. The browser window is called the container. It is possible to divide the container into several frames and use each frame for displaying a different html document.
3. Frames have the following characteristics: each frame is given a name; each frame will be targeted by a html document; each frame resizes itself dynamically in response to the changes in the size of visible client area.
4. Typical component of forms are text field, text area, checkbox, radio buttons and push buttons.
5. HTML allows us to place these form components on the web page and send the desired information to the destination server.
6. Frames allow dividing the browser window into sub-regions.
7. By displaying multiple documents, you can compare their data.
8. You can also use frames to show index as links in one sub-region and the corresponding document in their other sub-region.
9. This way, the index will never go out of sight while browsing through the document.
10. Frames can divide the browser window horizontally or vertically.
11. You can also nest a frame within another frame. You can display tables, links forms and images through frames.
12. To split the browser window, you need to create frames. Frames allow you to display different HTML pages in one browser window.
13. To create frames, you need to create a FRAME document, except that a <FRAMESET> container replaces the <BODY> container.
14. A <FRAMESET> container describes the HTML document or frames that make up the page.
15. A standard frame has no BODY element and cannot contain tags that would normally be placed in the BODY element.
16. If they appear in the frame document, the <FRAMESET> tag is ignored.

Frames Tag Attribute

1. To display different HTML pages in different frames, you need to use the <frame> tag.
2. The <frame> tag has no matching end tag. The frame element, which uses the <frame> tag has following attributes: SRC, NAME, MARGINWIDTH, MARGINHEIGHT, SCROLLING, NORESIZE, FRAMEBORDER and FRAMESPACING.

The SRC Attribute

1. The SRC attribute takes as its value the URL of the document to be displayed in the frame.
2. Frame without an SRC attribute are displayed as a blank space of the size of the frame.
3. Its value can be any URL. For example, src="/html/top_frame.htm" will load an HTML file available in html directory.

The NAME Attribute

1. The NAME attribute is used to assign a name to a frame, so that it can be targeted by links in other documents.
2. The documents are usually from other frames in the same document.
3. This attribute is optional by default all frames are unnamed.
4. Names must begin with an alphanumeric character. Given below are certain reserved names starting with an underscore.
5. There is no need to explicitly assign them to the NAME attribute. They need to be specified with the TARGET attribute.
6. It is used to indicate which frame a document should be loaded into.
7. This is especially important when you want to create links in one frame that load pages into an another frame, in which case the second frame needs a name to identify itself as the target of the link.
8. _blank: By specifying TARGET = "_blank", the document will be loaded in a new window.
9. Although these are reserved names for the NAME attribute of the FRAME element, they are to be referred to using a <A> tag.
10. It is used to target specific windows, allowing smoother transition between framed documents and between framed and normal documents.

The MARGINWIDTH Attribute

1. The MARGINWIDTH attribute is used when the document author wants to control the margin for the frame.
2. It has to be specified as a pixel value. Margins cannot be less than one.
3. This attribute allows you to specify the width of the space between the left and right of the frame's borders and the frame's content. The value is given in pixels. For example marginwidth="10".

The MARGINHEIGHT Attribute

1. This attribute allows you to specify the height of the space between the top and bottom of the frame's borders and its contents.
2. The value is given in pixels. For example marginheight="10".

The SCROLLING Attribute

1. This attribute describes if the frame should have a scroll-bar or not.
2. This attribute controls the appearance of the scroll-bars that appear on the frame.
3. If the value is "yes", the scroll-bar will always be visible on the frame.
4. The "no" value means that scroll-bars are never shown, while the "auto" value adds scroll-bars wherever they are needed.
5. The scrolling attribute is optional, by default, the value is "auto".

The NORESIZE Attribute

1. This attribute has no value. It is just a flag, which informs the user that the frame is not re-sizable by the user.
2. Users typically re-size the frames by dragging a frame edge to a new position.
3. If any of the frames adjacent to an edge is not re-sizable, than entire edge will be restricted from moving.
4. This will affect the re-sizability of other frames.
5. The NORESIZE attribute is optional by default, all frames are re-sizable.
6. By default you can re-size any frame by clicking and dragging on the borders of a frame. The noresize attribute prevents a user from being able to re-size the frame.
7. For example noresize="noresize".

The FRAMEBORDER Attribute

1. This attribute allows control of the frame border display.
2. With this attribute set to "0", the borders for the specific frame are not drawn.
3. This attribute specifies whether or not the borders of that frame are shown, it overrides the value given in the frame-border attribute on the <frameset> tag if one is given, and this can take values either 1 (yes) or 0 (no).

The FRAMESPACING Attribute

1. This attribute allows the setting of extra space around frames to give the appearance of floating frames.
2. The "value" should be the distance required around the frame, in pixels.
3. For example, <FRAME FRAMESPACING = "55" ...> would display the frame with a spacing of 55 pixels.

Creating Frames

1. To use frames on a page we use <frameset> tag instead of <body> tag.
2. The <frameset> tag defines how to divide the window into frames.
3. The rows attribute of <frameset> tag defines horizontal frames and cols attribute defines vertical frames.
4. Each frame is indicated by <frame> tag and it defines which HTML document shall open into the frame.

Example program

<!DOCTYPE html>
<html>
<head>
<title>HTML Frames</title>
</head>
<frameset rows="10%,80%,10%">
   <frame name="top" src="/html/top_frame.htm" />
   <frame name="main" src="/html/main_frame.htm" />
   <frame name="bottom" src="/html/bottom_frame.htm" />
   <noframes>
   <body>
      Your browser does not support frames.
   </body>
   </noframes>
</frameset>
</html>

Output: The window is divided into three horizontal frames labelled Top Frame, Main Frame and Bottom Frame (FIG 9.11: Output of creating frames).

Example program

<!DOCTYPE html>
<html>
<head>
<title>HTML Frames</title>
</head>
<frameset cols="25%,50%,25%">
   <frame name="left" src="/html/top_frame.htm" />
   <frame name="center" src="/html/main_frame.htm" />
   <frame name="right" src="/html/bottom_frame.htm" />
   <noframes>
   <body>
      Your browser does not support frames.
   </body>
   </noframes>
</frameset>
</html>

Output: The window is divided into three vertical frames, the left and right frames taking 25% each and the middle frame taking 50% (FIG 9.12: Output of creating frames).

Disadvantages of Frames

1. There are few drawbacks with using frames, so it's never recommended to use frames in your web pages. There are,
2. Some smaller devices cannot cope with frames often because their screen is not big enough to be divided up.
3. Sometimes your page will be displayed differently on different computers due to different screen resolution.
4. The browser's back button might not work as the user hopes.
5. There are still few browsers that do not support frame technology.

Browser Support for Frames

1. If a user is using any old browser or any browser which does not support frames then <noframes> element should be displayed to the user.
2. So you must place a <body> element inside the <noframes> element because the <frameset> element is supposed to replace the <body> element, but if a browser does not understand <frameset> element then it should understand what is inside the <body> element which is contained in a <noframes> element.
3. You can put some nice message for your user having old browsers. For example Sorry!! your browser does not support frames. As shown in the above example.

Frames names and target attributes

1. One of the most popular uses of frames is to place navigation bars in one frame and then load main pages into a separate frame.
2. Let's see following example where a test.htm file has following code.

Example program

<!DOCTYPE html>
<html>
<head>
<title>HTML Target Frames</title>
</head>
<frameset cols="200, *">
   <frame src="/html/menu.htm" name="menu_page" />
   <frame src="/html/main.htm" name="main_page" />
   <noframes>
   <body>
      Your browser does not support frames.
   </body>
   </noframes>
</frameset>
</html>

1. Here we have created two columns to fill with two frames.
2. The first frame is 200 pixels wide and will contain the navigation menu bar implemented by menu.htm file.
3. The second column fills in remaining space and will contain the main part of the page and it is implemented by main.htm file.
4. For all the three links available in menubar, we have mentioned target frame as main_page, so whenever you click any of the links in menubar, available link will open in main_page.

Example program

<!DOCTYPE html>
<html>
<body bgcolor="#4a7d49">
<a href="http://www.google.com" target="main_page">Google</a>
<br /><br />
<a href="http://www.microsoft.com" target="main_page">Microsoft</a>
<br /><br />
<a href="http://news.bbc.co.uk" target="main_page">BBC News</a>
</body>
</html>

The following is the main.htm file.

<!DOCTYPE html>
<html>
<body bgcolor="#b5dcb3">
<h3>This is main page and content from any link will be displayed here.</h3>
<p>So now click any link and see the result.</p>
</body>
</html>

The output shows the three links Google, Microsoft and BBC News in a narrow left frame and the main page message in the right frame (FIG 9.13: Output of target frames).

Target Attributes

One of the most popular uses of frames is to place navigation bars in one frame and then load main pages into a separate frame.

OptionDescription
_selfLoads the page into the current frame.
_blankLoads a page into a new browser window opening a new window.
_parentLoads the page into the parent window, which in the case of a single frameset is the main browser window.
_topLoads the page into the browser window, replacing any current frames.
targetframeLoads the page into a named targetframe.

FIG 9.14: Target Attributes option

Forms

1. Forms are used to accept data from the user. This data can be personal information from the user or some feedback from the user.
2. Forms help to enhance the web site depending on the user's feedback. To create a form, FORM element is required.
3. It uses the opening and closing <FORM>......</FORM> tags.
4. Different controls such as text box, option buttons, images and checkbox can be put in a form.
5. Forms cannot be nested, but a web page can contain more than one form.
6. The actual working of a form involves the ACTION and the METHOD attribute to be set.
7. The ACTION attribute specifies the URL. The METHOD attribute can take up two values - GET and POST.
8. Both the values of the METHOD attribute work for the same purpose, with a slight difference.
9. When "Post" is used as the value of method attribute, the information is sent as a block of data through an HTTP post transaction.
10. When "GET" is used, the form information is added to the URL.
11. The page is opened as if it were an anchor. The default value of the METHOD attribute is "GET".
12. HTML forms enable you to accept data over the internet. You can accept feedback, conduct a web survey or collect information from the users using HTML forms.
13. The various form elements used to create an HTML form are,

1. HTML Forms are required when you want to collect some data from the site visitor.
2. For example during user registration you would like to collect information such as name, email address, credit card, etc.
3. A form will take input from the site visitor and then will post it to a back-end application such as CGI, ASP Script or PHP script etc.
4. The back-end application will perform required processing on the passed data based on defined business logic inside the application.
5. There are various form elements available like text fields, text area fields, drop-down menus, radio buttons, checkbox, etc.

Syntax

<form>
...
input elements
...
</form>

Forms Attributes

Apart from common attributes, following is a list of the most frequently used form attributes.

HTML Form Controls

There are different types of form controls that you can use to collect data using HTML form: Text Input Controls, Checkbox Controls, Radio Box Controls, Select Box Controls, File Select Controls, Hidden Controls, Clickable Buttons, and Submit and Reset Button.

Input TypeValue of the Type AttributesExample
Checkbox“checkbox”<input type=”checkbox” name=a>
Radio button“radio”<input type=”radio” name=a>
Text field“text”<input type=”text” name=a>
Password field“password”<input type=”password” name=a>
Hidden field“hidden”<input type=”hidden” name=a>
Button“button”<input type=”button” name=a>
Submit button“submit”<input type=”submit” name=a>
Reset button“reset”<input type=”reset” name=a>

FIG 9.15: HTML form controls

Text Input Controls

There are three types of text input used on forms: Single Line Text Input Controls, Password Input Controls and Multi Line Text Input Controls.

Single Line Text Input Controls

This control is used for items that require only one line of user input, such as search boxes or names. They are created using HTML <input> tag.

Example program

<!DOCTYPE html>
<html>
<head>
<title>Text Input Control</title>
</head>
<body>
<form >
First name:  <input type="text" name="first_name" />
<br>
Last name:  <input type="text" name="last_name" />
</form>
</body>
</html>

Output: Two text boxes are shown, one after the label First name and one after the label Last name (FIG 9.16: Output of single line text input control).

Password Input Controls

This is also a single line text input but it masks the character as soon as a user enters it. They are also created using HTML <input> tag.

Example program

<!DOCTYPE html>
<html>
<head>
<title>Password Input Control</title>
</head>
<body>
<form >
User ID :  <input type="text" name="user_id" />
<br>
Password:  <input type="password" name="password" />
</form>
</body>
</html>

Output: Two boxes are shown, one for User ID and one for Password; the characters typed in the password box appear masked (FIG 9.17: Output of password input control).

Attributes

AttributeDescription
typeIndicates the type of input control and for password input control it will be set to password.
nameUsed to give a name to the control which is sent to the server to be recognized and get the value.
valueThis can be used to provide an initial value inside the control.
sizeAllows to specify the width of the text-input control in terms of characters.
maxlengthAllows to specify the maximum number of characters a user can enter into the text box.

FIG 9.18: Attributes of password input control

Multi Line Input Controls

This is used when the user is required to give details that may be longer than a single sentence. Multi line input controls are created using HTML <textarea> tag.

Example program

<!DOCTYPE html>
<html>
<head>
<title>Multiple-Line Input Control</title>
</head>
<body>
<form>
Description : <br />
<textarea rows="5" cols="50" name="description">
Enter description here...
</textarea>
</form>
</body>
</html>

Output: A label Description is shown above a large text box of 5 rows and 50 columns containing the text "Enter description here..." (FIG 9.19: Output of multiple line input control).

Attributes

AttributeDescription
nameUsed to give a name to the control which is sent to the server to be recognized and get the value.
rowsIndicates the number of rows of text area box.
colsIndicates the number of columns of text area box

FIG 9.20: Attributes of multiple line input control

Checkbox Controls

1. Checkbox is used when more than one option is required to be selected.
2. They are also created using HTML <input> tag but type attribute is set to checkbox.

Example program

<!DOCTYPE html>
<html>
<head>
<title>Checkbox Control</title>
</head>
<body>
<form>
<input type="checkbox" name="maths" value="on"> Maths
<input type="checkbox" name="physics" value="on"> Physics
</form>
</body>
</html>

Output: Two check boxes are shown with the labels Maths and Physics (FIG 9.21: Output of checkbox control).

Attributes

AttributeDescription
typeIndicates the type of input control and for checkbox input control it will be set to checkbox.
nameUsed to give a name to the control which is sent to the server to be recognized and get the value.
valueThe value that will be used if the checkbox is selected.
checkedSet to checked if you want to select it by default.

FIG 9.22: Attributes of checkbox control

Radio Button Control

1. Radio buttons are used when out of many options, just one option is required to be selected.
2. They are also created using HTML <input> tag but type attribute is set to radio.

Example program

<!DOCTYPE html>
<html>
<head>
<title>Radio Box Control</title>
</head>
<body>
<form>
<input type="radio" name="subject" value="maths"> Maths
<input type="radio" name="subject" value="physics"> Physics
</form>
</body>
</html>

Output: Two round radio buttons are shown with the labels Maths and Physics (FIG 9.23: Output of radio button control).

Attributes

AttributeDescription
typeIndicates the type of input control and for radio input control it will be set to radio.
nameUsed to give a name to the control which is sent to the server to be recognized and get the value.
valueThe value that will be used if the radio box is selected.
checkedSet to checked if you want to select it by default.

FIG 9.24: Attribute of radio button control

Select Box Control

A select box, also called drop down box which provides option to list down various options in the form of drop down list, from where a user can select one or more options.

Example program

<!DOCTYPE html>
<html>
<head>
<title>Select Box Control</title>
</head>
<body>
<form>
<select name="dropdown">
<option value="Maths" selected>Maths</option>
<option value="Physics">Physics</option>
</select>
</form>
</body>
</html>

Output: A drop-down list is shown with Maths selected (FIG 9.25: Output of select box control).

Attributes of <select> tag

AttributeDescription
nameUsed to give a name to the control which is sent to the server to be recognized and get the value.
sizeThis can be used to present a scrolling list box.
multipleIf set to "multiple" then allows a user to select multiple items from the menu.

FIG 9.26: Attributes of select tag

Attributes of <option> tag

AttributeDescription
valueThe value that will be used if an option in the select box is selected.
selectedSpecifies that this option should be the initially selected value when the page loads.
labelAn alternative way of labeling options

FIG 9.27: Attributes of option tag

Field Upload Box

1. If you want to allow a user to upload a file to your web site, you will need to use a file upload box, also known as a file select box.
2. This is also created using the <input> element but type attribute is set to file.

Example program

<!DOCTYPE html>
<html>
<head>
<title>File Upload Box</title>
</head>
<body>
<form>
<input type="file" name="fileupload" accept="image/*" />
</form>
</body>
</html>

Output: A Choose File button is shown with the text No file chosen next to it (FIG 9.28: Output of field upload box).

Attributes

AttributeDescription
nameUsed to give a name to the control which is sent to the server to be recognized and get the value.
acceptSpecifies the types of files that the server accepts.

FIG 9.29: Attribute of field upload box

Button Controls

1. There are various ways in HTML to create clickable buttons.
2. You can also create a clickable button using <input> tag by setting its type attribute to button.
3. The type attribute can take the following values: submit, reset, button and image.

Example program

<!DOCTYPE html>
<html>
<head>
<title>Button Controls</title>
</head>
<body>
<form>
<input type="submit" name="submit" value="Submit" />
<input type="reset" name="reset"  value="Reset" />
<input type="button" name="ok" value="OK"  />
<input type="image" name="imagebutton" src="/html/images/logo.png" />
</form>
</body>
</html>

Output: The Submit, Reset and OK buttons are shown, followed by an image button (FIG 9.30: Output of button control).

Hidden Form Controls

1. Hidden form controls are used to hide data inside the page which later on can be pushed to the server.
2. This control hides inside the code and does not appear on the actual page.
3. For example, following hidden form is being used to keep current page number.
4. When a user will click next page then the value of hidden control will be sent to the web server and there it will decide which page has be displayed next based on the passed current page.

Example program

<!DOCTYPE html>
<html>
<head>
<title>Hidden Form Control</title>
</head>
<body>
<form>
<p>This is page 10</p>
<input type="hidden" name="pagename" value="10" />
<input type="submit" name="submit" value="Submit" />
<input type="reset" name="reset"  value="Reset" />
</form>
</body>
</html>

Output: The text This is page 10 is shown with the Submit and Reset buttons; the hidden field is not visible (FIG 9.31: Output of hidden form control).

HTML Images

1. Images play an important part in a web site. They make our web pages appear more eye catching and descriptive.
2. A judicious use of images with text can make your web page quite appealing.
3. In the following sections we will learn how to insert images to our web pages and how to work with them properly to make the web page impressive.
4. Always use images in jpeg or gif format since most of the browsers support these two formats.
5. The <img> tag is empty, which means that it contains attributes only and it has no closing tag.
6. To display an image on a page, you need to use the src attribute. Src stands for "source".
7. The value of the src attribute is the URL of the image you want to display on your page.
8. The IMG SRC tag is used for inserting images to a web page. The syntax of defining an image.

Syntax:

<img src="url" alt="some_text">

1. Not only does the source attribute specify what image to use, but where the image is located.
2. For example, with src="graphics/chef.gif" the browser will look for the image name chef.gif in a graphics folder in the same folder as the html document itself.
3. Images are the second aspect of a pleasant web experience.
4. The problems with images are legion if they are not used wisely.
5. First, experienced or impatient web surfers often switch image loading off by default, on their browsers.
6. If your site relies on an image to get important information across, these people may never see it.
7. Second, loading images is a slow process and if you use too many, or your images are too large, the download times can easily become intolerable.
8. Browsers display a limited range of image types. You can only guarantee that GIF and JPG will be displayed everywhere, although more and more browsers are now able to display the PNG format, which was intended as a free replacement for the GIF format when that was copyrighted.
9. If you want high-quality, good compression and loss of colors use JPG, for instance when displaying photographs.
10. Generally, though GIFs are more common as they tend to be smaller files, lots of software can manipulate them and can be animated.

Image attributes

1. A picture or an image in the web page can be inserted using the <img> tag.
2. The <img> tag has several attributes to inform the source, height of the picture, width of the picture alignment etc.: src, Height, Width, Align and alt.

src and alt

1. The src attribute specifies the source of the picture. It gives the file name of the picture file.
2. The two parameters src and alt, define where to find the image and text to display if the user agent cannot display the image (or is set not to display images at all).
3. These two parameters comprise the minimal set of parameters for any image tag.
4. Here is an example of the image tag that will insert a computer image, computer.jpg, into a document with the alternate text "A picture of a computer".

<img src="computer.jpg" alt="A picture of a computer">

Height and Width

The height and the width may be expressed in terms of either pixels or percentage or units. The default is the pixels.

Syntax

1. Specifies that the width of the image should be NUMBER pixels.
2. If no dimensions are specified for the image, the browser will insert the image exactly as is, at the same size as you would view it in a picture editor on your computer.
3. The picture will load slightly faster if you specify the height and width so that the browser does not have to determine it.
4. User may also find it quicker and easier to specify a specific width and height for the image in the HTML, rather than editing and resizing the image on the computer.

Align

The align attribute can be used to align the picture.

Insert Image

1. User can insert any image in the web page by using <img> tag.
2. The <img> tag is an empty tag, which means that it can contain only list of attributes and it has no closing tag.

Syntax

<img src="Image URL" ... attributes-list/>

To try following example, let's keep our HTML file test.htm and image file test.png in the same directory.

Example program

<!DOCTYPE html>
<html>
<head>
<title>Using Image in Webpage</title>
</head>
<body>
<p>Simple Image Insert</p>
<img src="test.png" alt="Test Image" />
</body>
</html>

Output: The text Simple Image Insert is shown followed by the picture test.png (FIG 9.32: Output of insert image).

1. User can use PNG, JPEG or GIF image file based on the comfort but make sure user specify correct image file name in src attribute. Image name is always case sensitive.
2. The alt attribute is a mandatory attribute which specifies an alternate text for an image, if the image cannot be displayed.

Set Image Location

1. Usually we keep all the images in a separate directory.
2. So let's keep HTML file test.htm in our home directory and create a subdirectory images inside the home directory where we will keep our image test.png.
3. Assuming our image location is "images/test.png", try the following example.

Example program

<!DOCTYPE html>
<html>
<head>
<title>Using Image in Webpage</title>
</head>
<body>
<p>Simple Image Insert</p>
<img src="images/test.png" alt="Test Image" />
</body>
</html>

Output: The picture is loaded from the images folder (FIG 9.33: Output of set image location).

Set Image Width/Height

1. User can set image width and height based on the requirement using width and height attributes.
2. User can specify width and height of the image in terms of either pixels or percentage of its actual size.

Example program

<!DOCTYPE html>
<html>
<head>
<title>Set Image Width and Height</title>
</head>
<body>
<p>Setting image width and height</p>
<img src="test.png" alt="Test Image" width="150" height="100"/>
</body>
</html>

Output: The picture is shown in a box 150 pixels wide and 100 pixels high (FIG 9.34: Output of set image width/height).

Set Image Border

1. By default image will have a border around it, you can specify border thickness in terms of pixels using border attribute.
2. A thickness of 0 means, no border around the picture.

Example program

<!DOCTYPE html>
<html>
<head>
<title>Set Image Border</title>
</head>
<body>
<p>Setting Image Border</p>
<img src="test.png" alt="Test Image" border="3"/>
</body>
</html>

Output: The picture is shown with a border 3 pixels thick (FIG 9.35: Output of set image border).

Set Image Alignment

By default image will align at the left side of the page, but you can use align attribute to set it in the center or right.

Example program

<!DOCTYPE html>
<html>
<head>
<title>Set Image Alignment</title>
</head>
<body>
<p>Setting image Alignment</p>
<img src="test.png" alt="Test Image" border="3" align="right"/>
</body>
</html>

Output: The picture is shown at the right side of the page (FIG 9.36: Output of set image alignment).

Multimedia

1. Multimedia is any combination of text, graphics, video, audio and animation in a distributed format that consumers can interact with using a digital device.
2. Multimedia can be thought of as a super medium of sorts, because it represents the blending together of previously distinct and non-combination, forms of human expression.
3. Multimedia computing has produced a revolution. The multimedia computer captures all manner of worldly experience and even presents us with worlds of its own.
4. Revolutions displace traditional beliefs and practices. They also create entirely new activities and products.
5. The industrial revolution displaced traditional craftsmanship goods that had been produced by hand in small shops were now made in factories by machines. The multimedia revolution is also displacing tradition and ushering in new products and activities.
6. The defining elements of modern multimedia, including its different forms: Non interactive, and Interactive (Basic, Hypermedia, Adaptive, Immersive).
7. The word multimedia comes from the Latin words “multus” which means numerous and “media” which means middle or center.
8. Multimedia, in the general sense, therefore, means “multiple intermediaries” between the source and sink of information or “multiple means” by which information is stored, transmitted, presented or perceived.
9. The multiple means by which we can perceive information are the following,

MediumExample
Textbook chapter, newspaper article
Imagephotograph
Graphicssketch, diagram
Soundspeech, music
VideoTV program, movie clip
Animationanimation clip

Characteristics of Multimedia

1. There is no general consensus on the exact definition of multimedia. Several definitions have been proposed by authors with varying scopes.
2. Multimedia is an interdisciplinary application oriented technology that capitalizes on the multi-sensory nature of humans.
3. The following as important characteristics of a multimedia presentation such as: Multiple media, Non linearity, Scope of interactivity, Integrity and Digital Representation.

Browser support

1. The first web browsers had support for text only, limited to a single font in a single color.
2. Later came browsers with support for colors and fonts, and even support for pictures.
3. The support for sounds, animations, and videos is handled differently by various browsers. Different types and formats are supported, and some formats requires extra helper programs (plug-ins) to work.

Multimedia Formats

1. Multimedia elements (like sounds or videos) are stored in media files.
2. The most common way to discover the type of a file, is to look at the file extension.
3. When a browser sees the file extension .htm or .html, it will treat the file as an HTML file.
4. The .xml extension indicates an XML file, and the .css extension indicates a style sheet file.
5. Pictures are recognized by extensions like .gif, .png and .jpg.
6. Multimedia files also have their own formats and different extensions like: .swf, .wav, .mp3, .mp4, .mpg, .wmv, and .avi.

Common Video Formats

MP4 is the new and upcoming format for the internet video.

FormatFileDescription
MPEG.mpg, .mpegMPEG. Developed by the Moving Picture Expert Group. The first popular on the web. Used to be supported by all browsers.
AVI.aviAVI (Audio Video Interleave). Developed by Microsoft. Commonly used in video cameras and TV hardware. Plays well on Windows computer, but not in web browsers.
WMV.wmvWMV (Windows Media Video). Developed by Microsoft. Commonly used in video cameras and TV hardware. Plays well on Windows computer, but not in web browsers.
QuickTime.movQuickTime. Developed by Apple. Commonly used in video cameras and TV hardware. Plays well on Apple computers, but not in web browsers.
RealVideo.rm, .ramRealVideo. Developed by Real Media to allow video streaming with low bandwidths. It is still used for online video and Internet TV, but does not play in web browsers.
Flash.swf, .flvFlash. Developed by Macromedia. Often requires an extra component (plug-in) to play in web browsers.
Ogg.oggTheora Ogg. Developed by the Xiph.Org Foundation. Supported by HTML5.
WebM.webmWebM. Developed by the web giants, Mozilla, Opera, Adobe, and Google.
MPEG-4 or MP4.mp4MP4. Developed by the Moving Pictures Expert Group. Based on QuickTime. Commonly used in newer video cameras and TV hardware.

FIG 9.38: Common video format

Sound Formats

1. MP3 is the newest format for compressed recorded music.
2. The term MP3 has become synonymous with digital music.

FormatFileDescription
MIDI.mid, .midiMIDI (Musical Instrument Digital Interface). Main format for all electronic music devices like synthesizers and PC sound cards. MIDI files do not contain sound, but digital notes that can be played by electronics. Plays well on all computers and music hardware, but not in web browsers.
RealAudio.rm, .ramRealAudio. Developed by Real Media to allow streaming of audio with low bandwidths. Does not play in web browsers.
WMA.wmaWMA (Windows Media Audio). Developed by Microsoft. Commonly used in music players. Plays well on Windows computers, but not in web browsers.
AAC.aacAAC (Advanced Audio Coding). Developed by Apple as the default format for iTunes. Plays well on Apple computers, but not in web browsers.
WAV.wavWAV. Developed by IBM and Microsoft. Plays well on Windows, Macintosh, and Linux operating systems.
Ogg.oggOgg. Developed by the Xiph.Org Foundation.
MP3.mp3MP3 files are actually the sound part of MPEG files. MP3 is the most popular format for music players. Combines good compression (small files) with high quality.
MP4.mp4MP4 is a video format, but can also be used for audio. MP4 video is the upcoming video format on the internet. This leads to automatic support for MP4 audio by all browsers.

FIG 9.39: Sound format

HTML Exercises

1. Create a webpage that prints your name to the screen.
2. Create a webpage and set its title to "This is a webpage".
3. Create a webpage that prints any text of your choosing to the screen, do not include a head section in the code.
4. Print two paragraphs that are both indented using &nbsp; command.
5. Print two lists with any information you want. One list should be an ordered list, the other list should be an unordered list.
6. Prints an h1 level heading followed by a horizontal line whose width is 100%. Below the horizontal line print a paragraph relating to the text in the heading.
7. Print some deleted and inserted text of your choosing.
8. Display five different images. Skip two lines between each image. Each image should have a title.

Summary

In this class, we have learn about,

1. The concept of HTML page structure.
2. The process of HTML Text.
3. The basics of HTML links.
4. The concept of document tables.
5. The process of HTML frames.
6. The process of HTML images.
7. The process of basic operations of multimedia.

Computer Science Exam Resources: Web Design

Quick Revision Material for Web Design

Explore essential learning tools for Computer Science Web Design. This curated collection features in-depth notes and targeted practice questions built around the active 2026 curriculum to streamline your daily revision.

Expert Notes and Solved Exam Questions

Built using official NCERT guidelines for Computer Science, these materials provide reliable academic support. Integrating past examination questions and step-by-step solutions helps students understand official CBSE grading criteria.

Additional Study Resources for

Maximize your grade potential by utilizing Computer Science practice papers in tandem with these structured notes. All printable assignments and interactive mock tests on our platform are updated for the 2026 session and available free of charge.

FAQs

Where can I find the most advanced study material for [current-page:node:field_board] [current-page:node:field_class] Computer Science for 2026-27?

The latest 2026-27 advanced study resources for Computer Science are available for free on StudiesToday.com which includes NCERT Exemplars, high-order thinking skills (HOTS) questions, and deep-dive concept summaries.

What does the 2026-27 Computer Science study package for [current-page:node:field_class] include?

Our exhaustive Computer Science package includes chapter wise revision notes, solved practice sheets, important formulas and Concept Maps to help in better understanding of all topics.

Is this study material enough for both [current-page:node:field_board] exams and competitive tests?

Yes. For , our resources have been developed to help you get better marks in school exams and also build fundamental strength needed for entrance tests including Competency Based learning.

How should [current-page:node:field_class] students use this Computer Science material for maximum marks?

in , students should use Active Recall method, read the concept summary, then solve the Important Questions section without looking at the answers and then check your answers.

Can I download [current-page:node:field_class] Computer Science study notes in PDF for offline use?

All Computer Science study materials are provided in mobile-friendly PDF. You can download and save them on your device.

Are the [current-page:node:field_class] Computer Science resources updated for the latest NEP guidelines?

Yes, our team has ensured that all Computer Science materials for are strictly aligned with the National Education Policy (NEP) 2020 and the latest 2026-27 syllabus.