HTML 10 Questionsauro

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 20

1) Tags that are asked:

Table tag
Head tag
OL tag UL tag DL tag
Marquee tag
Image tag
Ans)
1. Table Tag:
The table tag is used to create tables in HTML. Tables
are often used to display data in a tabular format. Here's
an example of a simple HTML table:

```
<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table>
```
In this example, we have a table with two columns,
"Header 1" and "Header 2", and one row of data with
the values "Data 1" and "Data 2".

2. Head Tag:
The head tag is used to contain metadata about an
HTML document, such as the page title, author, and
other information that's not displayed in the browser
window. Here's an example of a simple HTML head
section:

```
<!DOCTYPE html>
<html>
<head>
<title>My Page Title</title>
</head>
<body>
<p>Hello, world!</p>
</body>
</html>
```

3. OL Tag, UL Tag, and DL Tag:


These are all used to create lists in HTML, but they
have different purposes:

- OL (Ordered List) tag is used to create a numbered


list, with each item in the list marked with a number.
Example:

```
<ol>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>
```
- UL (Unordered List) tag is used to create a bulleted
list, with each item in the list marked with a bullet
point. Example:

```
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
```
- DL (Definition List) tag is used to create a list of
terms and their definitions. Each term is marked with a
term tag (`<dt>`) and each definition is marked with a
definition tag (`<dd>`). Example:

```
<dl>
<dt>Term 1</dt>
<dd>Definition 1</dd>
<dt>Term 2</dt>
<dd>Definition 2</dd>
<dt>Term 3</dt>
<dd>Definition 3</dd>
</dl>
```
4. Marquee Tag:
The marquee tag is used to create scrolling text or
images. Here's an example:

```
<marquee>Hello, world!</marquee>
```

5. Image Tag:
The image tag is used to embed images in an HTML
document. Here's an example:

```
<img src="path/to/image.png" alt="A description of the
image">
```
In this example, we have an image tag with two
attributes: `src`, which specifies the path to the image
file, and `alt`, which provides a description of the image
for accessibility purposes.
2) Internet vs intranet vs extranet
1. Ans) Internet refers to the global network of
interconnected computers and servers that
communicate with each other using the Internet
Protocol (IP). It allows people to access and share
information and resources from anywhere in the
world.
Intranet is a private network that is accessible only to an
organization's employees, contractors, or members. It is
used to share information, collaborate on projects, and
access company resources such as databases,
documents, and applications.
Extranet is a private network that extends beyond an
organization's boundaries to include selected external
partners, vendors, or customers. It provides a secure and
controlled environment for exchanging information and
conducting business transactions with external parties.

3) What is css how to define, declare and hierarchy in


brief

CSS (Cascading Style Sheets) is a stylesheet


language used to define the visual appearance of
HTML elements on a web page. CSS allows web
developers to separate the content of a webpage from
its presentation, making it easier to update the look
and feel of the website without having to change its
content.
Here's a brief overview of how to define, declare, and
hierarchy in CSS:

1. Define: CSS styles are defined using selectors,


properties, and values. Selectors target HTML
elements on the page, while properties and values
define the visual style of the targeted element. For
example:

```
selector {
property: value;
}
```

2. Declare: CSS styles can be declared in several


ways, including:

- Inline styles: These styles are defined within the


HTML tag using the "style" attribute. For example:

```
<p style="color: red;">This text is red.</p>
```

- Internal styles: These styles are defined within the


`<head>` section of an HTML document using the
`<style>` tag. For example:

```
<head>
<style>
selector {
property: value;
}
</style>
</head>
```

- External styles: These styles are defined in a


separate CSS file and linked to the HTML document
using the `<link>` tag. For example:

```
<head>
<link rel="stylesheet" href="style.css">
</head>
```

3. Hierarchy: CSS styles are applied in a cascading


order, with more specific styles overriding less
specific ones. The hierarchy of CSS selectors is as
follows:

- Inline styles have the highest priority and will


override other styles.
- ID selectors are more specific than class selectors.
- Element selectors are less specific than ID or class
selectors.
- Styles defined later in the CSS file will override
styles defined earlier.

It's important to keep in mind that CSS hierarchy can


be complex, and there are many factors that can
influence how styles are applied on a webpage.
However, understanding these basic concepts is a
good starting point for working with CSS.
4) Explain the different ways to insert a JavaScript
in HTML code with examples
Ans) There are three main ways to insert JavaScript
code into an HTML document:
1. Inline script - The JavaScript code is written
directly within the HTML tag using the "onclick"
event. For example:
<button onclick="alert('Hello World!')">Click
me</button>
2. Internal script - The JavaScript code is written
within the <script> tag in the <head> section of the
HTML document. For example:
<head> <script> function sayHello() { alert("Hello
World!"); } </script> </head> <body> <button
onclick="sayHello()">Click me</button> </body>
3. External script - The JavaScript code is written in a
separate .js file and linked to the HTML document
using the <script> tag in the <head> section. For
example:
<head> <script src="script.js"></script> </head>
<body> <button onclick="sayHello()">Click
me</button> </body>
5) How can a css class be implemented with pseudo
class?
Ans) A CSS class can be implemented with a pseudo-
class by combining the class selector with the pseudo-
class selector using a colon (:). This allows you to
apply a certain style to elements that meet both the
class and pseudo-class criteria.
Here is an example of how to implement a CSS class
with a pseudo-class:

```
/* Define the CSS class */
.my-class {
font-weight: bold;
}

/* Apply the class to a link element with the pseudo-


class selector */
a.my-class:hover {
color: red;
}
```

In this example, we have defined a CSS class called


`.my-class` with a `font-weight` of `bold`. Then, we
have applied this class to a link element using the
class selector (`a.my-class`), and added a pseudo-
class selector (`:hover`) to change the color of the
link to red when it is hovered over.
Note that the order of the class and pseudo-class
selectors is important - the class selector should come
first, followed by the pseudo-class selector. This is
because the pseudo-class selector refers to a specific
state or behavior of the element, which is dependent
on the presence of the class.
6) )different types of selectors in css (any two)
Ans)

Sure, here are two types of selectors in CSS:

1. ID Selectors: This type of selector is used to target


a specific HTML element based on its unique ID
attribute. ID selectors are denoted with a hash symbol
(#) followed by the ID name. For example, if you
have an HTML element with an ID of "header", you
can target it in CSS using the following selector:

```
#header {
/* CSS styles here */
}
```
2. Class Selectors: Class selectors are used to target
HTML elements based on their class attribute. Class
selectors are denoted with a period (.) followed by the
class name. For example, if you have an HTML
element with a class of "button", you can target it in
CSS using the following selector:

```
.button {
/* CSS styles here */
}
```

Both ID and Class selectors are very common in CSS


and are used extensively in styling web pages.
7) input tag in detail
Ans)

The `input` tag is one of the most commonly used


HTML tags, and it is used to create different types of
form fields that allow users to input data. The `input`
tag has many different types, including `text`,
`password`, `checkbox`, `radio`, `submit`, and many
more. Here are some of the most common attributes
of the `input` tag:

- `type`: This attribute specifies the type of input


field. For example, `type="text"` creates a text input
field, while `type="checkbox"` creates a checkbox
input field.

- `name`: This attribute is used to give the input field


a name, which is used when the form is submitted to
the server.

- `value`: This attribute is used to set the default value


of the input field.

- `placeholder`: This attribute is used to provide a hint


or an example of the type of data that should be
entered into the input field.

- `required`: This attribute is used to make the input


field required, meaning that the user must enter data
into the field before submitting the form.

8).methods of document object


Ans) Methods of the Document Object:

The `Document` object is the root of the HTML


document tree and is part of the DOM (Document
Object Model) API. Here are some common methods
of the `Document` object:

- `getElementById()`: This method returns the first


element with a matching ID attribute.

- `getElementsByClassName()`: This method returns


an array of elements with matching class names.

- `getElementsByTagName()`: This method returns an


array of elements with matching tag names.

- `createElement()`: This method creates a new


HTML element.

- `appendChild()`: This method adds a new child


element to an existing element.
- `removeChild()`: This method removes a child
element from an existing element.

9). methods of window object


Ans)Methods of the Window Object:

The `Window` object represents the browser window


that contains the HTML document and is also part of
the DOM API. Here are some common methods of
the `Window` object:

- `alert()`: This method displays a message box with a


message and an OK button.

- `prompt()`: This method displays a message box


with a message and a text input field for the user to
enter data.

- `confirm()`: This method displays a message box


with a message and OK and Cancel buttons.

- `setInterval()`: This method repeatedly calls a


function at a specified interval.
- `setTimeout()`: This method calls a function after a
specified amount of time has elapsed.

- `open()`: This method opens a new browser window


or tab.

- `close()`: This method closes the current browser


window or tab.
10) Font and text properties in CSS
Ans) Sure! Here are some common font and text
properties in CSS:

1. `font-family`: This property is used to set the font


for an element, and it specifies a list of font families
and/or generic family names to use. For example:

```
p{
font-family: Arial, sans-serif;
}
```
2. `font-size`: This property is used to set the size of
the font for an element. For example:

```
p{
font-size: 16px;
}
```

3. `font-weight`: This property is used to set the


weight (or thickness) of the font for an element. For
example:

```
p{
font-weight: bold;
}
```

4. `color`: This property is used to set the color of the


text for an element. For example:
```
p{
color: red;
}
```

5. `text-align`: This property is used to set the


horizontal alignment of text for an element. For
example:

```
p{
text-align: center;
}
```

6. `text-decoration`: This property is used to add a


decoration (such as an underline, overline, or
strikethrough) to the text of an element. For example:

```
a{
text-decoration: underline;
}
```

7. `line-height`: This property is used to set the height


of a line of text. For example:

```
p{
line-height: 1.5;
}
```

These are just a few examples of font and text


properties in CSS. There are many more properties
that can be used to customize the appearance of text
on a web page.

You might also like