0% found this document useful (0 votes)
7 views2 pages

HTML CSS Interview Questions Answers

The document provides a comprehensive list of HTML and CSS interview questions and answers. Key topics include differences between various HTML elements, the purpose of CSS, and concepts like the box model and media queries. It serves as a useful resource for candidates preparing for web development interviews.

Uploaded by

moumita1453
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)
7 views2 pages

HTML CSS Interview Questions Answers

The document provides a comprehensive list of HTML and CSS interview questions and answers. Key topics include differences between various HTML elements, the purpose of CSS, and concepts like the box model and media queries. It serves as a useful resource for candidates preparing for web development interviews.

Uploaded by

moumita1453
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

HTML & CSS Interview Questions and Answers

HTML Interview Questions:

1. Difference between <div> and <span>:


<div> is a block-level element used to group larger sections of content. <span> is an inline element
used to style small portions of text.

2. Difference between id and class in HTML:


id is unique and used for one element only. class can be used for multiple elements.

3. Difference between <head> and <body>:


<head> contains metadata (title, links, scripts). <body> contains visible content displayed in the
browser.

4. Difference between <ul> and <ol>:


<ul> creates an unordered (bulleted) list. <ol> creates an ordered (numbered) list.

5. Block-level vs Inline elements:


Block-level elements take full width and start on a new line. Inline elements take only required width
and do not start on a new line.

6. Semantic HTML elements:


Elements that clearly describe their meaning (e.g., <header>, <article>, <footer>).

7. DOCTYPE in HTML:
Declares the HTML version and helps the browser render the page correctly.

8. Void elements:
Elements that do not have closing tags (e.g., <br>, <img>, <hr>).

9. Making input required:


Use the 'required' attribute inside the input tag.

10. Difference between HTML and HTML5:


HTML5 is the latest version with new semantic elements, audio/video support, local storage, and
improved APIs.

CSS Interview Questions:

1. CSS stands for Cascading Style Sheets.

2. Types of CSS:
Inline, Internal, and External CSS.

3. Box Model:
Consists of content, padding, border, and margin.

4. Difference between id and class in CSS:


id selector (#) targets one unique element. class selector (.) can target multiple elements.

5. Pseudo-classes:
Special keywords that define element states (e.g., :hover, :focus).

6. Position values:
static (default), relative (positioned relative to itself), absolute (relative to nearest positioned
ancestor), fixed (relative to viewport).

7. Media queries:
Used for responsive design to apply styles based on screen size or device type.

8. z-index:
Controls stacking order of positioned elements.

9. Padding vs Margin:
Padding is space inside the border. Margin is space outside the border.

10. visibility: hidden vs opacity: 0:


visibility: hidden hides the element but keeps its space. opacity: 0 makes it transparent but still
clickable and occupies space.

You might also like