Module 1 (HTML)
Module 1 (HTML)
Q1. Are the HTML tags and elements the same thing?
Ans.No HTML tags and elements are not same thing.
HTML tags are defining the structure of html.
Html tags are enclosed with angle brackets.
Example of attributes
<a href=”www.google.com”>Click here</a>
href attribute specifies the url of page.
<ol>
<li>Tea</li>
<li>Coffee</li>
<li>Bourn Vita</li>
</ol>
OUTPUT:
1.Tea
2.Coffee
3.Bourn Vita
<ul>
<li>Pizza</li>
<li>Cake</li>
<li>Burger</li>
</ul>
OUTPUT:
Pizza
Cake
Burger
Definition list: Definition list defines the list of terms and their definitions
In definition list ‘dt’ is define the data term and ‘dd’ defines
the data definition.
<dl>
<dt>pizza</dt>
<dd>Margherita pizza</dd>
<dt>coffee</dt>
<dd>cold coffee</dd>
<dt>Tea</dt>
<dd>ice tea</dd>
</dl>
OUTPUT:
pizza
Margherita pizza
coffee
cold coffee
Tea
ice tea
.class name {
}.
Q7. What is the difference between the ‘id’ attribute and the ‘class’ attribute of
HTML elements?
Ans. ‘Id’ and ‘Class’ attributes are used to specify the style of html element.
‘Id’ is the unique identifier for html.
‘Class’ is the non-unique identifier for html.
‘Id’ attribute is used to identify specific element on page.
CSS.
#intro {
Font-weight: bold;
}
. main {
Background-color: blue;
}
<html>
<head>
<title>Document</title>
</head>
<body>
<table border="1" cellpadding="50" align="center">
<tr>
<td>cell 1</td>
<td>cell 2</td>
</tr>
</table>
</body>
</html>
Cell spacing:
<html>
<head>
<title>Document</title>
</head>
<body>
<table border="1" cellspacing="50" align="center">
<tr>
<td>cell 1</td>
<td>cell 2</td>
</tr>
</table>
</body>
</html>
Q10. How can we club two or more rows or columns into a single row or column in an
HTML table?
Ans. In html table we can merge two or more cell using rowspan and colspan.
Rowspan is use to merge two or more row in single row.
Colspan is use to merge two or more column in single column.
<html>
<head>
</head>
<body>
<table border="1">
<tr>
<td rowspan="2">cell 1</td>
<td>cell 2</td>
<td>cell 3</td>
</tr>
<tr>
<td>ROw1</td>
<td>Row2</td>
</tr>
</table>
</body>
</html>
<html>
<head>
</head>
<body>
<table border="1">
<tr>
<td rowspan="2">cell 1</td>
<td>cell 2</td>
<td>cell 3</td>
</tr>
<tr>
<td>ROw1</td>
<td>Row2</td>
</tr>
</table>
</body>
</html>
Q11. What is the difference between a block-level element and an inline element?
Ans. Block level elements cover full width of container.
Block level elements include <h1>…<h6> and <div> etc..
Inline elements cover necessary width.
Inline elements include <b>…<i>…<u> etc…
<html>
<head>
<title>document</title>
</head>
<body>
<h1 style=” background-color: green;” >Hello World</h1>
</body>
</html>
Output:
<html>
<head>
<title>Document</title>
<body>
</body>
</html>
Output:
Example of hyperlink:
<html>
<head>
<title>Document</title>
</head>
<body>
<a href=”www.google.com” target=”_blank”>click here</a>
</body>
</html>
Output:
Q13. What is the use of an iframe tag?
Ans. Iframe stands for ‘inline frame’.
Iframe syntax is <iframe src=”URL”>…</iframe>
Iframe tag allows you to display external content on your webpage.
Iframe tag include external content like {YouTube videos, google maps etc…}.
< html>
<head>
<title>Document</title>
</head>
<body>
Output:
Q14. What is the use of a span tag? Explain with example?
Ans. Span tag is an inline element.
Span tag is used to group inline element and apply style to them.
the <span> tag is useful for applying styles inline elements within a larger block of
text.
<html>
<head>
<title>Image</title>
</head>
<body>
<img src=” E:\IMG_0171.JPG”>
</body>
</html>
Q16. How are active links different from normal links?
Ans. Normal link is non clickable link.
Normal link colour is purple.
click here
Active link: Active links are known as live links or clickable links.
When link is in active state its colour is blue.
click here
<br> This tag is used to break the line before or after line.
<p> This tag is used to define the paragraph of text. It adds line break.
It is used to create graphics that can be scaled without losing resolution or quality.
SVG image are based on mathematical equation that describes the shapes, lines
and curves of the graphics.
SVG image can be create and edit using vector graphics software.
Q19. What is difference between HTML and XHTML?
Ans. HTML vs xhtml: Html stands for hypertext markup language.
Physical tag:
<html>
<head>
<title>Image</title>
</head>
<body>
<h1>This is a First Heading</h1>
<p>This is a Paragraph</p>
</body> </html>
Logical tag:
<html>
<head>
<title>Image</title>
</head>
<body>
<i>Italic</i>
<u>Underline</u>
</body>
</html>