HTML Unit1&2 Notes
HTML Unit1&2 Notes
5) In HTML tables, gap between two cells of same table are known as.
A. Cell Spacing
B. Cell Padding
C. Cell Difference
D. None of the above
10) <DT> tag is designed to fit a single line of our web page but <DD> tag will accept a
A. line of text
B. full paragraph
C. word
D. request
11) Correct HTML to left align the content inside a table cell is
A. <tdleft>
B. <td raligh = "left">
C. <td align ="left">
D. <td leftalign>
12) The tag used to create a new list item and also include a hyperlink is
A. <LI>
B. <DL>
C. <DD>
D. <UL>
Understanding Level
13) How can you open a link in a new browser window?
A. < a href = "url" target ="new">
B. <a href = "url" target="_blank">
C. <a href = "url".new>
D. <a href = "url" target="open">
20) The web standard allows programmers on many different computer platforms to
dispersed format and display the information server. These programs are called
A. Web Browsers
B. HTML
C. Internet Explorer
D. None of these
25) Which attribute is used with <img> tag to display the text if image could not load in
browser?
A. Description
B. Name
C. alt
D. id
Long Questions
1) What is HTML? What are the Features of HTML?
HTML is an acronym which stands for Hyper Text Markup Language.
Hyper Text: Hyper Text simply means "Text within Text". A text has a link within it,
is a hypertext. Every time when you click on a word which brings you to a new
webpage, you have clicked on a hypertext.
Markup language: A markup language is a programming language that is used make
text more interactive and dynamic. It can turn a text into images, tables, links etc.
FEATURES:
It is a very easy and simple language. It can be easily understood and modified.
It is very easy to make effective presentation with HTML because it has a lot of
formattingtags.
It is a markup language so it provides a flexible way to design web pages along with
thetext.
It facilitates programmers to add link on the web pages (by html anchor tag), so it
enhancesthe interest of browsing of the user.
It is platform-independent because it can be displayed on any platform like
Windows,Linux and Macintosh etc.
It facilitates the programmer to add Graphics, Videos, and Sound to the web pages
whichmakes it more attractive and interactive.
1. a name and
2. a value
Examples:
Bgcolor RGB: it Specifies a background color for a document
Align left, right, center:- Deprecated − Specifies the alignment of the horizontal rule.
<HTML> Tag
It is the root of the html document which is used to specify that the document is
html. This tag tells the browser that this is an HTML document.
The <HTML> tag is the container for all other HTML elements (except for the
<!DOCTYPE> tag). Practically <HTML> is the first tag in an HTML page and
</HTML> is the last tag.
<HEAD> Tag
It contains the head of an HTML document, which holds informa
information
tion about the document
such as its title. Once we opened this tag then we must close it as </HEAD>.
Eg:
<html>
<head>
<title> welcome </title>
</head>
<body>
<h1>The example</h1>
<p> welcome to HTML </p>
</body>
</html>
<BODY> Tag
The HTML <BODY> tag is used for indicating the main
content section of the HTML document. This tag defines
the document's body. It contains all the contents of an
HTML document such as text, hyperlinks, images, tables,
lists, etc.
<BODY> tag is opened, it must be closed </BODY> before the closing of
</HTML> tag.
Example:
<html>
<body>
<img src="C:\Users\Public\Pictures\Sample Pictures\Tulips.jpg"
width="100" height="100" alt="Flower" border="5"
align="center" >
</body>
</ht
ml>
8) How do you create Hyperlink in HTML. Explain with example
The <A> tag defines a hyperlink, which is used to link from one page to another.
The most important attribute of the <A> element is the href attribute, which
indicates the link's destination.
By default, links will appear as follows in all browsers:
An unvisited link is underlined and blue
A visited link is underlined and purple
An active link is underlined and red
Ex: <a href="https://www.w3schools.com">Visit W3Schools.com!</a>
9) How to define table and what are the different attributes associate with it
with example explain.
An HTML table is defined with the <TABLE> tag. Each table row is defined
with the <TR>tag. A table header is defined with the <TH> tag. By default, table
headings are bold and centered. A table data/cell is defined with the <TD>tag.
<TH> Tag
The <TH> tag defines a header cell in an HTML table.
Header cells - contains header information (created with the <TH> element)
Standard cells - contains data (created with the <TD>
default.
<TD> Tag
The <TD> tag defines a standard cell in an HTML table.An HTML table has two
kinds of cells:
Header cells - contains header information (created with the <TH> element)
Standard cells - contains data (created with the <TD> element)The text in
<TH> elements is bold and centered by default. The text in <TD> elements
is regular and left-aligned by default.
10) Explain how to merge rows and columns in table HTML with example.
To merge table columns in HTML use the colspan attribute in <td> tag. With this, merge cells with each other
<!DOCTYPE html>
<html>
<head>
</head>
<body style="text-align:center">
<h1 style="color:green;">
welcome
</h1>
<table align="center">
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Akku</td>
<td rowspan="2">44</td>
</tr>
<tr>
<td>fahad</td>
</tr>
</table>
</body>
</html>
11. Explain Absolute and Relative URL with example.
<h2>Relative URLs</h2>
<p><a href="html_images.asp">HTML Images</a></p>
<p><a href="/css/default.asp">CSS Tutorial</a></p>
A. text box.
B. radio button.
C. submit button.
D. All of these.
A. <select>
B. <text>
C. <textarea>
D. <dropdown>
3. Which HTML element is used to define multi-line input field?
A. <textarea>
B. <text>
C. <blockarea>
D. <textfields>
4. For defining a submit button which tag is used?
A. <button>
B. <submit button>
C. <submit>
D. <action submit>
5. When form data contains sensitive or personal information then which
method is more preferable?
A. Get method
B. Post method
C. Host method
D. Put method
6. In HTML form <input type=”text”> is used for?
A. One line text
B. Block of text
C. Paragraph
D. None
7. For creating a drop down list in HTML forms which element is suitable?
A. <list>
B. <dropdown>
C. <select>
D. All of the above
8. A ----------- tag defines a scale for the measurement of data within a
specified range.
A. Meter tag
B. Progress tag
C. Measure
D. Pre
9. <legend> is used to assign a caption to a set of form fields as defined by a
……………. element.
A) fieldset
B) caption
C) fieldgroup
D) assign
10. What is the default type of ‘type’ attribute of <input> element?
A. Text
B. Password
C. Numerals
D. Special Characters
11.Which attribute defines the file-select field?
A. file
B. checkbox
C. button
D. text
12.Which of the following is not used with password attribute?
A. name
B. size
C. maxlength
D. min
13.Which attribute is not used for the radio type?
A. name
B. value
C. checked
D. selected
14.Which attribute is used with <select> element?
A. multiple
B. selected
C. name
D. value
15. What is the purpose of HTML forms?
A. To display the content of an email.
B. To display animation effect.
C. To collect user input.
D. None of the above
The default value for the “position” attribute is _________.
A. fixed
B. absolute
C. inherit
D. relative
16.Choose the correct option
A. All of these
B. HTML form elements are defined inside form tag
C. HTML form elements are used for taking user input
D. HTML form elements can be of different types
17.Default method while submitting a form is
A. Set method
B. Post method
C. Get method
D. Put method
18.Action attribute in HTML forms specifies that
A. Which HTTP method is used
B. Where to submit form
C. Which action is going on
D. The auto completion
19.What is the default type of ‘type’ attribute of <input> element?
A. Special characters
B. Password
C. Numerals
D. Text
20.Which tag is used for grouping form controls?
A. <select>
B. <legend>
C. <label>
D. <fieldset>
21.How more than one option can be selected in drop down?
</body>
</html>
Radio Buttons are used when only one option is required to be selected. They are
created using
<input> tag as illustrated below.
Following is the list of important radiobox attributes:
· type: Indicates that you want to create a radiobox.
· name: Name of the control.
· value: Used to indicate the value that will be sent to the server if this
option isselected.
checked: Indicates that this option should be selected by default
<!DOCTYPE html>
<html lang="en">
<head>
<title>Progress tag</title>
</head>
<body>
<p>Normal Progress bar</p>
<progress></progress>
<p>Progress bar with max and value attributes</p>
<progress value="50" max="200"></progress>
<p>Progress bar with CSS</p>
<progress style="width:200px; height:40px;" ></progress>
</body>
</html>
Meter tag
A Meter tag is also known as a gauge and basically defines a scale for the
measurement of data within a specified range. The uses of a meter tag may
include the fuel left in the tank, the temperature of an object, etc. The meter tag is
written as follows.
Syntax:
<meter>....</meter>
Attributes: This tag accepts many attributes which are listed below.
· form: It defines one or more forms that the meter tag belongs to.
· max: It is used to specify the maximum value of a range.
· min: It is used to specify the minimum value of a range.
· high: It is used to specify the range considered to be a high value.
· low: It is used to specify the range value that is considered to below.
· optimum: It is used to specify the optimum value for the range.
· value: It is used to specify the required or actual value of the range.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Meter tag</title>
</head>
<body>
<p>Normal Meter</p>
<meter value="0.6"></meter>
<p>Meter tag with attributes</p>
<meter value="50" max="200" min="20"></meter>
<p>Meter tag with CSS</p>
<meter value="0.4" style="width:200px; height:40px;"></meter>
</body>
</html>
<FORM> Tag
The HTML <FORM> element defines a form that is used to collect user
input:
<h1>Hello world!</h1>
</body>
</html>
The CSS Grouping Selector
The grouping selector selects all the HTML elements with the same style definitions.
Look at the following CSS code (the h1, h2, and p elements have the same style definitions)
h1 {
text-align: center;
color: red;
}
h2 {
text-align: center;
color: red;
}
p{
text-align: center;
color: red;
}
It will be better to group the selectors, to minimize the code.
To group selectors, separate each selector with a comma.
h1, h2, p {
text-align: center;
color: red;
}
Example:
<html>
<body>
<form action="/cgi-bin/dropdown.cgi" method="post">
<select name="dropdown">
<option value="Maths" selected>Maths</option>
<option value="Physics">Physics</option>
<option value="Chemistry">Chemistry</option>
</select>
<input type="submit" value="Submit" />
</form>
</body>
</html>
Example:
<html>
<body style="background-color:yellow;">
<h2 style="background-color:red;">This is a heading</h2>
<p style="background-color:green;">This is a paragraph.</p>
</body>
</html>
</style>
</head>
<body>
I am Jahnavi. This is Internal Style sheet
<p> Cascading Style Sheets </p>
</body>
</html>
Example:
/* This is an external style sheet file. Save this file as
mystyle.css*/ hr
{
color: yellow;
}
h2
{
color: red;
text-align: left; font-size: 8pt;
That being said you’ll need to write custom CSS in order to change its appearance. The
default styling for the hr tag is pretty much similar across different browsers and consists of
CSS rules that style the border of the element.
hr {
border-style: inset;
border-width: 1px;
}
hr {