CSS ESSENTIAL 1 Flashcards

layout, Responsive design

1
Q

an element is ____ if the total height of an element is equal to its content and width is equal to the full width of the document (e.g. div,p,)

A

Block element

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

Can Block element contain either inline or block element(s)?

A

Yes!

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

an element is _____ if the total height of an element is equal to its content and width is <b>equal to the width of the content</b>, and only contain inline

A

inline element

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

is there an extra space between block element and another element?

A

yes! there is extra space after an inline element

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

How could you define a margin/padding of an HTML element? What are different ways to define margin/padding?

A

https: //i.imgur.com/kmketX6.png
1. to define a margin: of an element start at the top, right, bottom, left(clockwise)
2. Other ways are:
2. 1. margin: Top, [left and right], bottom;
2. 2 margin: [top and bottom], [left and right]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
div{
width:950px;
margin:0 auto;
}
So what is this snippet code does and its purpose?
A

set the width to 950px, and top and bottom margin to 0 and left and right to auto;

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

What is max-width? how to use it?

A

It is a CSS property that sets the max-width of an object. if the contained element is larger that containing the element, then the height of the containing element is adjusted to fit the contained element.

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

<a>dfdf</a>

a{
  padding:20px;
  border:solid black;
}
what is the purpose of padding for this scenario?
A

<a> is more clickable</a>

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

https://1drv.ms/u/s!Ant-SckYa-42g8s3bDYngWihVKeDAg

Why this happen after float:left is applied?

A

If you float an element, the precending elements will wrap on it and the natural flow of elements are changed?

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

what clear:both does

A

to not wrap the precending elements to the floated element

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

use of overflow:auto; and overflow:hidden;

A

to clear float for the parent of floated element. floated element overflows to the containing element. clearfix also clear the floated element(search it)

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

what #container does here

https://jsfiddle.net/testoftheyearend/opk24agb/10/

A

to not wrap preceding element use container (#container)

width should be defined

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

https://jsfiddle.net/testoftheyearend/smta9L2r/1/

A

CLEARFIX

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

The ________ property specifies the display behavior (the type of rendering box) of an element.

A

display

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

What is the total width and height, content box width and content height?

div.content-box {
width: 160px;
height: 80px;
padding: 20px;
border: 8px solid red;
background: yellow;
}

.content-box {
box-sizing: content-box;
}

A

/* Total width: 160px + (2 * 20px) + (2 * 8px) = 216px
Total height: 80px + (2 * 20px) + (2 * 8px) = 136px
Content box width: 160px
Content box height: 80px */
content is the defualt box-sizing property value which means the borser, margin, padding are not included to the overall size of content box(width and height).

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

What is box-sizing:border-box; ? what is the total height and width? what is content box width and box height?

div.border-box {
width: 160px;
height: 80px;
padding: 20px;
border: 8px solid red;
background: yellow;
}

.border-box {
box-sizing: border-box;
}

A

/* Total width: 160px
Total height: 80px
Content box width: 160px - (2 * 20px) - (2 * 8px) = 104px
Content box height: 80px - (2 * 20px) - (2 * 8px) = 24px */
The content, border, and padding are already included to total width and height

17
Q
What this css rules does
@font-face{
font-family:'Museo Sans';
src:url(museo-sans.ttf);
}
body{
font-family: 'Museo San', Arial, Sans-serif;
}
A

used to set the font name and link to the font files

18
Q

The ___ can be specified by <b>relative values</b> which are calculated based on the nearest ancestor element. <b>Absolute values</b> are not affected by an ancestor elements

A

font-size

19
Q

What is the default font size of an html element

A

16px

20
Q

Relative to the ancestor element font-size

A

em

21
Q

Relative to the root element font size which is the html tag

A

rem

22
Q

https://jsfiddle.net/testoftheyearend/v59ypofs/

what does it do?

A

important a font file to an HTML element

23
Q

CSS PROPERTY USES TO DEFINE SPACE BETWEEN LINES

A

LINE-HEIGHT

24
Q

ADD AND REMOVE UNDERLINE?

A

TEXT-DECORATION

25
Q

CHANGES THE CASING OF A TEXT

A

TEXT-TRANSFORM

26
Q

What are block and inline elements

A

Block means the elements aligns vertically, and inline means align horizontally. thre are also block-inline and none property value . Inline does not allow changing the height and width.

27
Q

explain this shit of code

https://jsfiddle.net/testoftheyearend/wbt5snfe/9/

A

You can add space to the left and right on an inline element(and bottom and top margin), but you cannot add height to the top or bottom margin of an inline element.

28
Q

inline-block vs inline

A

in inline-block you can set the width and height, and respect the top and bottom margin/padding but inline does not.

29
Q

inline-block vs block

A

the fucking bastard does no add line break for every element