0% found this document useful (0 votes)
16 views3 pages

HTML and CSS Test Answers Guide

The document provides answers to a class test on HTML and CSS, covering key concepts such as specificity, the CSS box model, fluid layouts, HTML tags, attributes, and the difference between ordered and unordered lists. It explains how to create links, comments, and tables in HTML, as well as the purpose and types of CSS. The information is structured in a question-and-answer format, making it easy to understand fundamental web development principles.

Uploaded by

aajeetsahani07
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

HTML and CSS Test Answers Guide

The document provides answers to a class test on HTML and CSS, covering key concepts such as specificity, the CSS box model, fluid layouts, HTML tags, attributes, and the difference between ordered and unordered lists. It explains how to create links, comments, and tables in HTML, as well as the purpose and types of CSS. The information is structured in a question-and-answer format, making it easy to understand fundamental web development principles.

Uploaded by

aajeetsahani07
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Answers for Class Test - HTML and CSS

1. What is specificity?

Specificity is a set of rules used by browsers to determine which CSS rule applies if multiple
rules could apply to the same element. It's calculated based on the types of selectors used:
inline styles > IDs > classes/attributes/pseudo-classes > elements/pseudo-elements.

2. What is CSS Box model explain with example.

The CSS Box Model is a box that wraps around every HTML element. It consists of margins,
borders, padding, and the actual content. Example:

```css
div {
width: 300px;
padding: 20px;
border: 10px solid black;
margin: 30px;
}
```

3. What is CSS Fluid Layouts? Different types of CSS Fluid layouts?

CSS Fluid Layouts use relative units like percentages instead of fixed units like pixels to
allow the layout to adapt to the screen size. Types:
- Percentage-based layout
- Flexbox layout
- Grid layout

4. What are HTML tags?

HTML tags are the building blocks of HTML. They define elements in an HTML document.
Most tags come in pairs: an opening tag and a closing tag.

5. What is the difference between tag and element?

A tag is part of an HTML element, enclosed in angle brackets. An element refers to the entire
structure from the opening tag to the closing tag, including the content inside.

6. What are HTML Attributes?

HTML attributes provide additional information about elements. They are always included
in the opening tag. Example: `<a href='[Link]

7. What is a marquee tag in HTML?


The `<marquee>` tag is used to create a scrolling text or image. It is not recommended for
use as it is obsolete in HTML5.

8. How do you separate a section of text in HTML?

You can use sectioning elements like `<div>`, `<section>`, `<article>`, or line break elements
like `<br>` and paragraph tags `<p>`.

9. What are void elements in HTML?

Void elements are HTML elements that do not have any content or closing tag. Examples:
`<br>`, `<img>`, `<input>`, `<hr>`

10. Differentiate between an Ordered list and an Unordered list.

Ordered List (`<ol>`) displays items in a numbered sequence. Unordered List (`<ul>`)
displays items with bullet points.

11. How do we insert a comment in HTML?

HTML comments are added using `<!-- comment here -->`.

12. How do you create links to different sections within the same HTML web
page?

Use anchor links with IDs. Example: `<a href="#section1">Go to Section 1</a>` and `<div
id="section1">Content</div>`

13. How do you create a hyperlink in HTML?

Use the `<a>` tag. Example: `<a href="[Link] Example</a>`

14. How do you display a table in an HTML webpage?

Use the `<table>` tag along with `<tr>`, `<th>`, and `<td>` tags. Example:

```html
<table>
<tr><th>Name</th><th>Age</th></tr>
<tr><td>Alice</td><td>25</td></tr>
</table>
```

15. What is CSS? Why do we use a style sheet in HTML? What are the different
types of CSS?

CSS (Cascading Style Sheets) is used to style HTML elements. It helps to separate content
from design. Types of CSS:
- Inline CSS
- Internal CSS
- External CSS

You might also like