CSS Flashcards

1
Q

How Many ways CSS can be applied to an HTML?

A

3 ways

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

What are the different ways of applying CSS to HTML?

A

External , Internal and Inline

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

Is there any precedence order in which the styles are applied between different ways?

A

There is no such precedence order applied. Instead , the styles are applied in the order which they are declared

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

What are different types of selectors in CSS?

A

Class selector , Id selector , Element Selector

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

How does CSS work?

A

CSS works much like Waterfall

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

Does Class selector have more specificity than Element Selector?

A

Yes

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

What properties are inherited ?

A

Font styles generally Typography is inherited

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

rgb() vs rgba()

A

The difference is that rgba(alpha) provides an extra parameter for transparency that ranges between 0 and 1.

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

What is rem?

A

rem implies one root element(default size of browser).It always sets the value relative to the root value

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

What is em?

A

em implies element and it sets the value relative to parent value

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

When to use em’s instead of rem’s?

A

When we set em on the element and the element does not look at the parent instead it looks after itself then we use em’s

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

Is Body Element always 100% ?

A

Body element grows the size of the content . To make it occupy 100% by default and grow size based on the content , use min-height:100vh property

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

what is css reset?

A

using wildcard *{} makes apply the properties inside *{} to be applied instead of default browser properties like margin , padding etc

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

What is border-box box sizing?

A

It includes padding and border along with the content when content size(width=400px) is specified . For example when width is 400 px , it includes padding:48px, border:4px(2*2px) and width size: 348px . On the other hand, if we use content-box then overall size will be 400+48+4 pixels . Content-size(width-box):400px will remain as it is and other properties will work as specified

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

Will margin be set for a div on left and right side by default?

A

No , we should use auto to see effect. Like , margin: 3rem auto

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

How to make a div as circle in CSS ?

A

By using border radius and setting it to about Half of the div’s height or width , we can make a square div into circle .

17
Q

What does inherit keyword do?

A

Inherit keyword allows inheriting the value of the parent element.

18
Q

What does text-transform do?

A

Using this , we can set text to capitalize , uppercase , lowercase etc

19
Q

What does text-align do?

A

It aligns the text to specified setting . like left makes the text align to left . like justify aligns the text to be uniform

20
Q

What does text-indent do?

A

It gives some indentation(space) at the start of the text

21
Q

What does line-height do?

A

Sets the height of line

22
Q

What does letter-spacing do ?

A

Sets the spacing between letters

23
Q

Are paragraph elements <p></p> block level?

A

Yes , they are block level

24
Q

How are block level elements arranged?

A

Block level elements are stacked one above the other.we can apply margin,padding etc to all the sides. Also they take up the complete width of the container where as inline elements take the wisth of the content it holds

25
Q

What does “display:inline-block” would do?

A

The element stays inline and supports block properties

26
Q

What does “clear” property do?

A

Empty Div with class=”clear” simply clears the floating content to the left side or right side or both depending on clear:left or clear: right or clear:both and makes the content start in the new line.

27
Q

Will the size of the container having both float and some other element depend on What element(float/other element )

A

It depends on the size of the other element. To keep the container on par with the Float element use “display:flow-root”.This fixes the resizing issue.

28
Q

What “break-inside:avoid” inside columns will do?

A

It will avoid the element from splitting while expanding or reducing the screen size

29
Q

What does “column-span:all” do?

A

It allows the element to be spanned across all columns

30
Q

What does “whitespace:nowrap” do?

A

It will wrap the whole element as one

31
Q

What are the possible values for position property?

A

Absolute , Fixed , Relative and Sticky

32
Q

How does absolute works?

A

It picks the ancestor with “relative” property closest to it.