Questions With Answers
Questions With Answers
1. **What are semantic HTML elements, and why are they important?**
Semantic HTML elements clearly define their meaning to both the browser and the developer.
Examples include `<header>`, `<footer>`, `<article>`, and `<section>`. They improve accessibility,
The `<doctype>` declaration specifies the HTML version used in the document, ensuring
- Inline: Elements like `<span>` flow with text and dont start on a new line.
- Block: Elements like `<div>` start on a new line and take up the full width.
- Inline-block: Combines features of both; elements flow inline but respect block-level width and
height properties.
`<div>` is a block-level container used for grouping content, while `<span>` is an inline container
5. **What are meta tags, and why are they important for SEO?**
Meta tags provide metadata about a web page, such as description, keywords, and author. They
Page 1
Technical Interview Questions
- Relative URL: Specifies a path relative to the current page (e.g., `./page`).
Lazy loading defers the loading of images until they are needed. It is implemented using the
Examples include `email`, `url`, `number`, `date`, `range`, `color`, and `search`.
- `async`: Downloads the script in parallel and executes it as soon as its ready.
- `defer`: Downloads the script in parallel but executes it after the HTML is fully parsed.
10. **What is the purpose of the `alt` attribute in the `<img>` tag?**
The `alt` attribute provides alternative text for images, improving accessibility and aiding SEO.
---
1. **What is the difference between relative, absolute, fixed, and sticky positioning in CSS?**
Page 2
Technical Interview Questions
- `sticky`: Toggles between relative and fixed, depending on the scroll position.
It consists of four areas: content, padding, border, and margin. This determines the size of
elements on a webpage.
3. **What is the difference between `em`, `rem`, and `px` units in CSS?**
The `z-index` controls the stack order of elements. Higher values appear in front of lower values.
Page 3
Technical Interview Questions
CSS Grid can define the main structure of a page, while Flexbox can manage layout inside
9. **What are media queries in CSS, and how are they used for responsive design?**
Media queries apply styles based on device properties like width and orientation (e.g., `@media
(max-width: 768px)`).
10. **What are keyframes in CSS, and how are they used for animations?**
```css
@keyframes slide {
to { transform: translateX(100px); }
```
---
Page 4
Technical Interview Questions
Page 5