HTML and CSS Question Answers
PART-A
1) What is HTML? Give the basic structure of an HTML page.
HTML (HyperText Markup Language) is used to create web pages.
Basic Structure:
<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
</head>
<body>
<h1>Welcome</h1>
</body>
</html>
2) Explain HTML elements for ordered and unordered lists.
Ordered List:
<ol>
<li>Step 1</li>
<li>Step 2</li>
</ol>
Unordered List:
<ul>
<li>Item A</li>
<li>Item B</li>
</ul>
3) Explain the CSS Box Model.
The CSS Box Model includes content, padding, border, and margin.
Example CSS:
.box {
border: 5px solid red;
4) Different ways to specify borders in CSS.
- Solid: border: 2px solid blue;
- Dotted: border: 2px dotted green;
5) Ways to specify color in CSS.
- Named Colors: color: red;
- RGB: color: rgb(255, 0, 0);
- Hex: color: #ff0000;
6) Explain simple CSS Selectors.
- Class: .classname {color: blue;}
- ID: #idname {font-size: 20px;}
7) Create an HTML document with a table using inline CSS.
<table style="border: 2px solid black;">
<tr><td>Row 1</td></tr>
</table>
8) CSS for text styles.
- Right align: text-align: right;
- Bold: font-weight: bold;
- Italics: font-style: italic;
PART-B
1) What is CSS?
CSS (Cascading Style Sheets) is used to style HTML elements.
Example CSS:
p { color: blue; }
2) Explain src and href attributes.
- src: Used in <img> and <script> for sources.
- href: Used in <a> for links.
3) Text shadow in CSS.
p { text-shadow: 2px 2px 5px gray; }
4) Specifying fonts in CSS.
p { font-family: Arial, sans-serif; font-size: 18px; }