CSS Flashcards

Interviews questions about css

1
Q

What is the difference between CSS and CSS3?

A

CSS (Cascading Style Sheets) is the fundamental language used for styling web pages. CSS3 refers to the latest version of CSS, introducing new features like rounded corners, gradients, animations, and more.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the selectors in CSS?

A

Selectors in CSS are patterns used to select and style HTML elements. Common selectors include element selectors (div, p), class selectors (.classname), ID selectors (#idname), attribute selectors ([attribute=value]), etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a media query in CSS?

A

A media query in CSS allows you to apply different styles based on specific device characteristics such as screen width, height, orientation, or resolution. It’s commonly used for responsive web design.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the different positions in CSS?

A

CSS offers various positioning properties like static (default), relative, absolute, fixed, and sticky. These properties control how an element is positioned within its parent container or the viewport.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is BOM (Box Object Model) in CSS?

A

BOM in CSS refers to the Box Model, which describes how elements are displayed as boxes with content, padding, border, and margin areas. Understanding the Box Model is essential for layout and spacing in CSS.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the difference between PX, EM, and REM units in CSS?

A

px (pixels) is an absolute unit relative to the screen pixel density.
em is a relative unit based on the font-size of its parent element.
rem (root em) is a relative unit based on the font-size of the root (<html>) element.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is Flexbox in CSS?

A

Flexbox is a layout model in CSS designed for creating flexible and efficient layouts. It allows you to align and distribute space among items within a container, handling complex alignment and sizing scenarios.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a pseudo-selector in CSS?

A

A pseudo-selector in CSS is used to select elements based on their state or position in the document. Examples include :hover, :first-child, :nth-child(), :not(), etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to make a website responsive?

A

To make a website responsive, use media queries, fluid layouts, flexible grids (like Flexbox or CSS Grid), relative units (em, rem), and optimize images for different screen sizes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are breakpoints for viewport-responsive devices?

A

Breakpoints are specific screen widths where the layout of a website changes to adapt to different devices (e.g., mobile phones, tablets, desktops). Common breakpoints include @media (max-width: 768px), @media (min-width: 1024px), etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Why do we use box-sizing in CSS?

A

box-sizing is a CSS property that determines how the total width and height of an element are calculated, including padding and border. By default (box-sizing: content-box;), padding and border are added to the width/height. Using box-sizing: border-box; includes padding and border within the specified width/height, simplifying layout calculations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly