CSS Flashcards

1
Q

What is the Box model in CSS? Which CSS properties are a part of it?

A

A rectangle box is wrapped around every HTML element. The box model is used to determine the height and width of the rectangular box. The CSS Box consists of Width and height (or in the absence of that, default values and the content inside), padding, borders, margin.

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

Actual Content of the box where the text or image is placed.

A

Content

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

Area surrounding the content (Space between the border and content).

A

Padding

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

Area surrounding the padding.

A

Border

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

Area surrounding the border.

A

Margin

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

How to include CSS in the webpage?

A
  1. External Style Sheet
  2. Embed CSS with a style tag
  3. Add inline styles to HTML elements
  4. Import a stylesheet file
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The _______ works like a wildcard character, selecting all elements on a page. In the given example, the provided styles will get applied to all the elements on the page

A

Universal Selector

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

This selector matches one or more HTML elements of the same name. In the given example, the provided styles will get applied to all the ul elements on the page

A

Element Type Selector

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

This selector matches any HTML element that has an ID attribute with the same value as that of the selector. In the given example, the provided styles will get applied to all the elements having ID as a container on the page

A

ID Selector

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

The ____ selector also matches all elements on the page that have their class attribute set to the same value as the class. In the given example, the provided styles will get applied to all the elements having ID as the box on the page

A

Class Selector

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

The _____ selector or, more accurately, the descendant combinator lets you combine two or more selectors so you can be more specific in your selection method

A

Descendant Combinator

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

A selector that uses the child combinator is similar to a selector that uses a descendant combinator, except it only targets immediate child elements

A

Child Combinator

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

A selector that uses a ______ to match elements based on sibling relationships. The selected elements are beside each other in the HTML

A

General Sibling Combinator

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

A selector that uses the ____ uses the plus symbol (+), and is almost the same as the general sibling selector. The difference is that the targeted element must be an immediate sibling, not just a general sibling

A

adjacent sibling combinator

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

The ____ selector targets elements based on the presence and/or value of HTML attributes, and is declared using square brackets

A

Attribute

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

What is the difference between inline, inline-block, and block?

A

Block Element: The block elements always start on a new line. They will also take space for an entire row or width. List of block elements are <div>, <p>.

Inline Elements: Inline elements don’t start on a new line, they appear on the same line as the content and tags beside them. Some examples of inline elements are <a>, <span> , <strong>, and <img></img> tags.</strong></span></a>

Inline Block Elements: Inline-block elements are similar to inline elements, except they can have padding and margins and set height and width values.</strong></span></a></p></div>

17
Q

What are the CSS Units?

A

px, em, pt, percentage (%)

18
Q

What are the differences between adaptive design and responsive design?

A

Adaptive design focuses on developing websites based on multiple fixed layout sizes.

Responsive design focuses on showing content on the basis of available browser space.

19
Q

What is a z-index, how does it function?

A

z-index is used for specifying the vertical stacking of the overlapping elements that occur at the time of its positioning. It specifies the vertical stack order of the elements positioned that helps to define how the display of elements should happen in cases of overlapping.

20
Q

To place an element exactly where you want to place it. absolute position is actually set relative to the element’s parent. if no parent is available then the relative place to the page itself (it will default all the way back up to the element).

A

Absolute

21
Q

“Relative to itself”. Setting position: relative; on an element and no other positioning attributes, it will no effect on its positioning. It allows the use of z-index on the element and it limits the scope of absolutely positioned child elements. Any child element will be absolutely positioned within that block

A

Relative

22
Q

The element is positioned relative to the viewport or the browser window itself. viewport doesn’t change if you scroll and hence the fixed element will stay right in the same position.

A

Fixed

23
Q

Static default for every single page element. The only reason you would ever set an element to position: static is to forcefully remove some positioning that got applied to an element outside of your control

A

Static

24
Q

Sticky positioning is a hybrid of relative and fixed positioning. The element is treated as relative positioned until it crosses a specified threshold, at which point it is treated as fixed positioned

A

Sticky

25
Q

What are the CSS position properties?

A
Absolute
Relative
Fixed
Static
Sticky