HTML Css
HTML Css
1. What is HTML?
Answer:
<!DOCTYPE html>
<html>
<head>
<title>My Web Page</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
html,css 1
2. HTML Headings
Answer:
HTML provides six levels of headings ( <h1> to <h6> ) to organize content
hierarchically.
Example:
<h1>Main Heading</h1>
<h2>Subheading</h2>
Modal Answer: <em> adds emphasis with meaning; <i> is only visual.
4. HTML Links
html,css 2
Answer:
Linking to a file:
Linking to email:
Modal Answer: Relative links point to local paths; absolute links use full
URLs.
5. HTML Lists
Answer:
HTML supports ordered ( <ol> ), unordered ( <ul> ), and description lists ( <dl> ).
Example:
<ul>
<li>Apple</li>
<li>Banana</li>
</ul>
Modal Answer: Use <dl> for key-value pairs, like terms and definitions.
html,css 3
6. HTML Images & Maps
Answer:
Use <img> to embed images, and <map> with <area> for clickable regions.
Example:
Modal Answer: Use CSS max-width: 100% or <picture> element for different
resolutions.
7. HTML Tables
Answer:
Tables are created using <table> , <tr> , <td> , <th> , and can merge cells with
colspan and rowspan .
Example:
<table border="1">
<tr><th>Name</th><th colspan="2">Contact</th></tr>
<tr><td>John</td><td>Email</td><td>Phone</td></tr>
</table>
8. HTML Forms
Answer:
html,css 4
Forms use <form> , <input> , <textarea> , <select> , and other elements to collect user
input.
Example:
Modal Answer: Text, password, email, checkbox, radio, submit, date, etc.
1. CSS Basics
Answer:
CSS styles HTML by selecting elements and applying rules.
Example:
h1 {
color: blue;
font-size: 24px;
}
html,css 5
Modal Answer: Classes use .class and can be reused; IDs use #id and must
be unique.
Example:
div {
width: 100px;
padding: 10px;
margin: 20px;
border: 1px solid black;
box-sizing: border-box;
}
Modal Answer: It includes padding and border in the element’s total width
and height.
3. CSS Positioning
Answer:
Positioning types: static , relative , absolute , fixed , sticky .
Example:
.sticky {
position: sticky;
top: 0;
}
html,css 6
How does absolute positioning work with respect to the parent?
Example (Flexbox):
.container {
display: flex;
justify-content: space-between;
align-items: center;
}
Example (Grid):
.grid-container {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 10px;
}
body {
background: linear-gradient(to right, red, blue);
html,css 7
font-family: Arial, sans-serif;
text-align: center;
}
div {
transition: transform 0.3s ease;
}
div:hover {
transform: scale(1.2);
}
7. Responsive Design
Answer:
Design that adapts to different screen sizes using media queries and flexible
units.
Example:
html,css 8
font-size: 14px;
}
}
Final Tips:
Practice semantic HTML and accessible forms.
html,css 9