Week 4 Flashcards

1
Q

What does this do? What is its default behaviour?
body { background-image:url(‘java.png’)
}

A

Sets the background as image. By default the image will repeat horizontally and vertically.

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

T/F - You can specify all properties in a property when using the background shorthand

A

True.

body {

}

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

T/F - You can specify all properties in a single property when using the background shorthand

A

True.

body {
background:color imageurl etc.
}

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

T/F - color: is used to set the background color in CSS

A

False. It’s used to set text color.

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

I would use this if I wanted to put an overline, line-through, or underline on my text

A

text-decoration

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

I would use this if I wanted to specify that certain text should be all uppercase or lowercase

A

text-transform

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

Cascading algorithm - 4 rules

A
  1. Importance - Imp. of each declaration (!important)
  2. Specificity - Of the CSS selectors
  3. Order - of the declarations in the source code
  4. Inheritance
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

<p>
Very pretty, very stylish
</p>

p {
color: blue;
}
p {
color: red;
}

What color is the text?

A

Red, due to order

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

Location - When styles conflict the _______ wins

A

nearest (most recently applied)

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

Internal CSS
Browser
Inline Style
External CSS

List them from weakest to strongest

A

Browser > External CSS > Internal CSS > Inline Style

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

T/F - The more specific the selector, the stronger the rule

A

True

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

p id=”text”>
Very pretty, very stylish
p>

text {
color: blue;
}
p {
color: red;
}

What color is the text?

A

Blue, since it’s more specific (id is the most specific there is)

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

p id=”text”>
Hello World!
p>

(id)text {
color: blue;
}
p {
color: red;
text-decoration: underline;
}

What colour is the text?

A

Blue with an underline (Specificity with the ID)

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

div
p id=”text”
Hello World!
/p
/div

div {
color: red;
text-decoration: underline;
}

What colour will the text be?

A

Red, Since there’s no conflict the red is inherited from the div parent

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

div
p id=”text”
Hello World!
p
div

(id)text {
color: blue;
}
div {
color: red;
text-decoration: underline;
}

What colour will the text be?

A

Blue, with a red underline - Text is specific, but the text-decoration is set in the div class, so it’s unaffected

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

T/F - Browsers have a default style

A

True

17
Q

(*){
margin: 0
padding: 0
}
This resets padding and margins. Why?

A

The Universal Selector * matches every element, which makes it good for broad actions like above

18
Q

T/F - You can only include multiple style sheets through the HTML document

A

False. You can also use the @import tool to link multiple css pages together

19
Q

In CSS, units of measurement are ________ units and ________ units

A

relative and absolute units

20
Q

Relative units are based on the _____ of the root font, while absolute units have a ____-_____ size

A

size, what absolute units have a real-world size

21
Q

1em is equal to the current

A

font size, meaning it’s a relative unit

22
Q

1pt is equal to 1/72 of an inch, meaning

A

It’s an absolute unit, px is the same (neither scale)

23
Q

100% is equal to

A

The current font size, meanings it’s a relative unit (scales)

24
Q

Viewport-percentage lengths: __ and __. These are relative to the size of the initial containing block. How much is 1 __ unit or __ unit compared to the initial containing block?

A

vw and vh. They’re 1% of the height/width

This is what it looks like
body { width: 80vw; }
main { width: 90%;
min-height: 100vh; }

25
Q

rem is the font size ________ to the ____ element of the web page

A

relative to the root element (size of the text in the html element)

26
Q

Quickly name what these font properties do
font-family
font-size
font-style
font-weight
font-variant

A

font-family - type of font
font size - size of font (can be units other than pt)
font-style - italic, oblique, normal
font-weight - bold or light
font-variant - normal, small caps

27
Q

This selector allows you to use a font even if it’s not installed on the user’s computer

A

@font-face

28
Q

In the CSS Box model

width = content width + / _______ + / b_____ + / ___g__

You can also set the height and width of the element using the h/w properties

A

In the CSS Box model

height = content height + L/R padding + L/R border + L/R margin

You can also set the height and width of the element using the h/w properties

29
Q

T/F - Padding defines a space between the element border and the element content

A

True

padding-top: 20px
Shorthand= padding: 20px

30
Q

T/F - Borders can be grooved, ridged, outset, inset, dotted

A

True. They can also be set to none

31
Q

“In CSS, the adjoining margins or two or more boxes can combine to from a single margin” Where does this definition come from? What about horizontal margins?

A

That’s the W3C definition of collapsing margins. Horizontal margins never collapse.