0% found this document useful (0 votes)
7 views

HTML_CSS_Complete_Answers (1)

The document provides a comprehensive overview of HTML and CSS, including definitions, basic structures, and examples of various elements such as lists, the CSS box model, and selectors. It also covers CSS properties for styling text, borders, and colors, along with practical examples of HTML documents and CSS syntax. Additionally, it explains attributes like src and href in HTML and how to apply text shadows using CSS.

Uploaded by

acharvinay35
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

HTML_CSS_Complete_Answers (1)

The document provides a comprehensive overview of HTML and CSS, including definitions, basic structures, and examples of various elements such as lists, the CSS box model, and selectors. It also covers CSS properties for styling text, borders, and colors, along with practical examples of HTML documents and CSS syntax. Additionally, it explains attributes like src and href in HTML and how to apply text shadows using CSS.

Uploaded by

acharvinay35
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

HTML and CSS Complete Question Answers

PART - A

1) What is HTML? Give the basic structure of an HTML page.

HTML (HyperText Markup Language) is the standard markup language for creating web pages. It

structures web content

using elements such as headings, paragraphs, images, and links.

Basic Structure:

<!DOCTYPE html>

<html>

<head>

<title>My Page</title>

</head>

<body>

<h1>Welcome</h1>

<p>This is a simple HTML page.</p>

</body>

</html>

2) Explain HTML elements for ordered and unordered lists.

Lists organize content systematically.

- Ordered List (<ol>) uses numbers.

- Unordered List (<ul>) uses bullet points.


Example:

<ol><li>Item 1</li><li>Item 2</li></ol>

<ul><li>Item A</li><li>Item B</li></ul>

3) Explain the CSS Box Model with an example.

The CSS Box Model includes:

- Content: The actual content inside the element.

- Padding: Space between content and border.

- Border: Surrounds padding.

- Margin: Space outside the border.

Example CSS:

.box { border: 5px solid red; padding: 10px; margin: 20px; }

4) Different ways of specifying borders in CSS.

- Solid: border: 2px solid blue;

- Dotted: border: 2px dotted green;

- Dashed: border: 2px dashed red;

- Double: border: 4px double black;

- Groove: border: 3px groove gray;

5) Explain different ways of specifying colors in CSS.

CSS allows specifying colors using:

- Named Colors: color: red;

- Hexadecimal: color: #ff5733;

- RGB: color: rgb(255, 87, 51);

- RGBA: color: rgba(255, 87, 51, 0.5);


- HSL: color: hsl(30, 100%, 50%);

6) Explain simple CSS Selectors.

- Universal (*) - Affects all elements.

- Element Selector - Affects specific HTML tags.

- Class Selector (.classname) - Styles specific classes.

- ID Selector (#idname) - Styles unique elements.

- Group Selector (tag1, tag2) - Applies styles to multiple elements.

7) Create an HTML document with a heading and a table.

Example:

<!DOCTYPE html>

<html>

<head><title>Table</title></head>

<body>

<h1 style="color: blue; text-align: center;">My Table</h1>

<table style="border:2px solid black; width:50%; margin:auto; background-color:lightgray;">

<tr><th>Name</th><th>Age</th><th>City</th></tr>

<tr><td>John</td><td>25</td><td>New York</td></tr>

<tr><td>Alice</td><td>30</td><td>Los Angeles</td></tr>

</table>

</body>

</html>

8) CSS directives for text styles.

- Right aligned text: text-align: right;

- Right-to-left direction: direction: rtl;


- Bold text: font-weight: bold;

- Italics: font-style: italic;

PART - B

1) What is CSS? Provide the syntax.

CSS (Cascading Style Sheets) styles HTML elements.

Syntax:

selector { property: value; }

Example:

p { color: blue; font-size: 18px; }

2) Explain src and href attributes in HTML.

- src: Specifies the source of an image or media.

Example: <img src="image.jpg" alt="Image">

- href: Defines the hyperlink destination.

Example: <a href="https://www.google.com">Visit Google</a>

3) Explain how text shadow is added using CSS.

Text shadows enhance text appearance.

Syntax: text-shadow: x-offset y-offset blur-radius color;

Example:

h1 { text-shadow: 2px 2px 5px gray; }

4) How fonts are specified using CSS.

Font properties:

- Font Family: font-family: Arial, sans-serif;


- Font Size: font-size: 16px;

- Font Weight: font-weight: bold;

- Font Style: font-style: italic;

You might also like