TeamTreeHouse CSS Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What does css allow for?

A

css allows for presentation and screensizes and resolutions

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

What are the three ways to add css to your page?

A

1- inline styles, 2- internal styles, 3- external stylesheets

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

How can you inspect an element?

A

right click it on a webpage

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

How to make text bold?

A

font-weight: bold;

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

how to control size of your font?

A

font-size: 2 em;

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

What is another way of expressing the styles “we” create?

A

author styles

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

How do we write inline-styles?

A

we write our css directly in our html element:

< body style = “ background - color : orange ; “ > blah < / body >

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

Should inline-styles be used under best practices?

A

NO

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

In the css cascade where do inline-styles fit in?

A

They override everything.

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

Where do you place internal styles?

A

internal styles are placed in the < head > section of your html using a < style > tag.

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

Code for an internal style …

A

< head >

< title > wha happin? < / title >

< style >

p {

font-size: 20px;

font-weight: bold;

}

< / head >

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

Are internal styles best practice?

A

NO

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

What does D.R.Y. mean?

A

Don’t Repeat Yourself

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

Where do you find external stylesheets?

A

Generally, in the same folder but in a different file as your html.

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

Why is it best practice to use external styles?

A

To keep seperate content from presentation.

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

How would you make text display in the center?

A

body {

text-align: center;

}

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

Where could you go to see if particular css code will work in a particular browser?

A

https : / / caniuse.com

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

What are the two main parts of a css rule?

A

the selector and the declaration

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

Which is the universal selector?

A

* {

property: value;

}

the asterisk

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

How do you control the color of text?

A

a {

color: blue;

}

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

How do you control for the background color of text?

A

a {

background-color: blue;

}

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

How do you get rid of the anchor underline?

A

a {

text-decoration: none;

}

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

What would you do to target just one element of your html?

A

use an id selector

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

How do you define an id selector on your html element?

A

< header >

< section id = “ education “ >

< ul >

….

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

How do you define an id selector in your css?

A

education {

border: 3px solid red;

}

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

For id names …

A
  1. start with a letter
  2. don’t include spaces
  3. avoid most punctuation
  4. hyphens/underscores OK
  5. meaninful names best
  6. must be unique
  7. 1 id per element at most
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What can be said about class selectors?

A

They can be used to target more than one html element.

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

If your selector is targeting something unique should you use a class or id?

A

Use an id.

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

How would you code a class in css?

A

with a dot

.top-skill {

font-weight: bold;

}

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

How do you code a class in html?

A

< li class = “ top-skill “> html < / li >

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

What can be said about class names?

A

they follow the same conventions as id names.

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

What can be said about classes and html elements?

A

You can apply as many classes to a single html element as you like.

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

How would you code for a rounded border?

A

border-radius: 12px;

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

How do you add more than one class to a html element?

A

< p class = “ date special “ > Blah < / p >

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

In css how do you capitalize your text?

A

text-transform: uppercase;

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

Can you add an id and a class to the same element?

A

YES, YES a thousand times YES!

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

Code for an id and class in a single html element …

A

< li class = “ top-skill “ id = “ proud “ > JS < / li >

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

Do id selector or classes carry more weight?

A

id selectors are more specific so therefore carry more weight

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

Should you share the same properties between classes and id’s?

A

NO, NO a thousand times NO!

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

How to choose the type of font you would like?

A

font-family: Ariel, sans-serif;

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

How to alter the spacing between letters?

A

letter-spacing: 3px;

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

How to change the styles of a list item?

A

li {

list-style: none;

}

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

How would we target only p elements found in the header element?

A

header p {

….

}

use a space between selectors, of course your highness

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

How would you target an h3 in your #education id?

A

education h3 {

…..

}

with a space between selectors

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

Can you target li’s in a particular type of list?

A

ol li {

….

}

with a space between selectors

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

What is a css pseudo-class?

A

Pseudo-classes target elements dynamically when they are in a certain state such as being hovered over by a mouse or selected using a keyboard.

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

What does the link pseudo-class do?

A

it allows us to style links that have not been visited yet …

a: link {
color: blue;

}

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

What does the visited pseudo-class selector allow us to do?

A

It allows us to target links that have already been visited …

a: visited {
color: seagreen;

}

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

What does the hover pseudo-class do?

A

It allows us to target an element when the mouse is hovering over it …

a:hover {

text-decoration: underline;

}

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

How do you underline text?

A

text-decoration: underline;

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

What does the first-child pseudo-class target?

A

the first-child selector allows us to target exactly what it sounds like, the first-child of a particular element …

ol li:first-child {

font-weight: bold;

}

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

How to comment in css?

A

/* some comment */, this also allows us to turn off some code when testing for example

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

What is a great resource for all things web and for css colors as well?

A

MDN docs, the mozilla developer network

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

What can be said about pixel units?

A

Px’s are absolute, they don’t scale and measure 1/96th of an inch.

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

What can be said about dimensions 800 x 600 ?

A

the width is the 800 value and the height is the 600 value.

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

What can be said about percentages?

A

They are always relative, never absolute.

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

What else can be said about the percentage value definition?

A

The size of the child-element adjusts in relation to the parent element …

header {

width: 80%;

margin-left: 10%;

}

header will be 80% of browser width regardless of browser width, the header being the child of the browser viewport element in this case.

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

What is the text default size?

A

16px’s

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

What are the two font relative units?

A

EM’s and REM’s

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

How are EM’s calculated?

A

by using the parent elements font-size, 1 em is equal to the font-size of the parent, 2 em’s is equal to twice that size.

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

What are REM’s always in reference to?

A

The root size element’s text-size, the html element’s size. If the html font-size is 32px’s and your < p > is defined in css as …

p {

font-size: 2 rem;

}

then it’s going to be 64px’s, see, well … do ya?

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

What are the 3 ways that color values can be expressed?

A
  1. color keyword 2. hex 3. RGB value
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
63
Q

What can generally be said about more specific styles in relation to less specific ones?

A

The more specific styles generally take precedence.

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

In order of precedence what will styles written later in the document do?

A

they will take over precedence and wield their power with an iron fist.

65
Q

What can be said about colors and inheritence?

A

Colors are inherited from their parent html elements.

66
Q

Where can you find a css validator?

A

jigsaw.w3.org/cssvalidator

67
Q

Generally, what does the css box model propose?

A

that every element in html can be considered a rectangular box.

68
Q

Code to set each padding element individually …

A

header {

padding - top : 10px;

padding - right : 15px;

padding - bottom : 10px;

padding - left : 15px;

}

69
Q

Code to add padding to all 4 sides with the same value …

A

header {

padding : 15px;

}

70
Q

Code to add padding to all four sides using just one property …

A

header {

padding : 10px 15px 20px 25px ;

}

the values run clockwise with the values running top, right, bottom then left

71
Q

Code for padding using just 3 values …

A

header {

padding : 10px 15px 20px;

}

values run top, sides, then lastly bottom

72
Q

Code padding using just two values …

A

header {

padding : 10px 15px ;

}

top and bottom, then both sides

73
Q

Which border properties can be set individually?

A

border-width, border-style, border-color

74
Q

Code for border using just one property …

A

header {

border : 12px solid red;

}

75
Q

Do margin properties and their values mimic the same dynamic as padding?

A

YES, YES, a thousand times YES!

76
Q

Can margins take on negative values, unlike properties tho ?

A

YES

77
Q

How would you code to move a, for example, footer to the center?

A

by using auto,

footer {

margin : 30px auto 15px;

}

78
Q

How do you include the border and padding in the box-size?

A

box-sizing : border-box;

79
Q

How do you control dimensions of an image by hand/code?

A

min-width

max-width

min-height

max-height

80
Q

What is the viewport?

A

area in which window-content can be seen

81
Q

What is 1 VW equal to?

A

1% of the viewport width

82
Q

What is 1 VH equal to?

A

1 VH is equal to 1% of the viewport height

83
Q

Code to hide an element, usually for testing purposes …

A

p {

display : none ;

}

84
Q

How to describe the behavior of block level elements?

A

block level elements take up 100% of their container, or parent element’s width by default. They’re also placed underneath each other, not side by side.

85
Q

How to describe the behavior of inline elements?

A

inline elements default display is on the same line as other content, also you can’t change the width or height of inline elements using css.

86
Q

Describe behavior of inline-block elements …

A

inline-block elements are inline as the naming suggests but you can change the width and height using css.

87
Q

Code to override an inline element, namely the anchor element in css …

A

a {

display : block ;

}

overrides default behavior

88
Q

How to “horizontalise” a block level < ul > to make it a nav?

A

ul li {

display : inline - block ;

width : 30 % ;

padding : 10px 0 ;

background - color : yellow ;

text - align : center ;

}

89
Q

How is positioning defined by default?

A

it is defined by default through the “normal” flow listed in the html document

90
Q

What is a relative position?

A

relative to itself

h1 {

position : relative ;

background - color : red ;

left : 60px ;

}

will move 60px to the left relative to its default position

91
Q

What is absolute positioning?

A

absolute positioning removes an element from the normal document flow, allows you to position the element based on the edges of the viewport …

h1 {

position : absolute ;

top : 20px ;

right : 10px ;

background-color : red ;

}

92
Q

What are some important caveats of using absolute positioning?

A

Absolute positioning actually is defined as positioned relative to the closest positioned ancestor. If a parent element uses relative positioning we can use absolute positioning to position a child element relative to the parent.

93
Q

What behaviors define fixed positioning?

A

Fixed positioning is relative to the viewport, not to any parent elements.

Fixed elements stay in place even while the page is scrolling.

header {

position : fixed ;

top : 0 ;

left : 0 ;

}

94
Q

What can be said about z-index?

A

z-index allows you to stack css boxes on top of one another.

higher z-index are stacked in front of the lower z-index

95
Q

What can be said about position sticky?

A

Sticky stays in the normal flow until you scroll the element to the top which is where it sticks.

h1 {

position : sticky ;

top : 0 ;

}

96
Q

What can be said about the float property?

A

Float allows you to place content on the right or left side and have content wrap around it.

place a class on an img

< img src = “ https : // www. …. “ class = “ small - img “ >

on css :

.small-img {

float : left ;

width : 300px ;

}

97
Q

What can be said about the clear property?

A

To make an element to not wrap around a floated element use clear :

.clear {

clear : both ;

}

98
Q

What is a css media query?

A

A css media query detects information about how your webpage is being viewed or a set of css rules that get applied based on device type or characteristics.

99
Q

Where are media queries placed?

A

They’re placed at the bottom of your stylesheet.

100
Q

Code for a print media query …

A

@ media print {

section {

min-height : auto ;

}

}

101
Q

what is a css selector

A

the target element, p for example in the following

p {

color : blue ;

}

102
Q

what is a declaration block?

A

everything except for the selector in the following, except for p.

p {

color : blue ;

}

103
Q

what is a css declaration?

A

in the following it is color : blue ;

p {

color : blue ;

}

104
Q

where does the css link go?

A

in the html < head >

105
Q

code for a css link

A

< link href = “ style.css “ type = “ text/css “ rel = “ stylesheet “ >

106
Q

what is a css property?

A

in the following it is color.

p {

color : blue ;

}

107
Q

what is a css value?

A

in the following it is blue.

p {

color : blue ;

}

108
Q

where do you place an internal stylesheet?

A

in the < head > of the html

109
Q

what element do you use to list an internal stylesheet?

A

< style >

p {

color : blue ;

}

< / style >

110
Q

code for a link to a css stylesheet using a URL

A

< lin href = “ https://www. … “ rel = “ stylesheet “ >

111
Q

code for a css link using a relative path

A

< link href = “ . / style.css “ rel = “ stylesheet “ >

112
Q

what is *?

A

it is the universal selector

113
Q

code for a css class in html and in the css file

A

< p class = “ brand “ > Sole Shoe Co. < / p >

above is the html,

the css is:

. brand {

….

}

114
Q

how to code in html for two css classes?

A

with a space:

< h1 class = “ green bold “ > …. < / h1 >

115
Q

which css element do we use if we want to style an html element uniquely?

A

use an id, one unique per page

116
Q

code for an id

A

large-title {

in the html:

< h1 id = “ large-title “ > …. < / h1 >

in the css:

….

}

117
Q

code for selecting an attribute

A

[href] {

color : magenta ;

}

118
Q

code for selecting a string in an attribute

A

in html:

< img src = “ / image/seasons/cold/winter.jpg “ >

in the css:

img [src * = “ winter “] {

height : 50 px ;

}

119
Q

list some pseudo-classes

A

:focus, :visited, : disabled, :active

120
Q

code for a p selector hover pseudo-class

A

p : hover {

background-color : lime ;

}

121
Q

what do id’s override?

A

classes and types

122
Q

what is best practice when deciding what type of selector to use?

A

first use types, then classes, then id’s

123
Q

what is it called when you combine multiple selectors?

A

chaining

124
Q

list a selector for h1 elements w/a class of .special

A

h1.special {

….

}

125
Q

write a css rule to select the descendants of the < ul class = “ main-list “ >

< li > …. < / li >

< / ul >

A

.main-list li {

…..

}

126
Q

code for font-family: Georgia for two selectors, an h1 and .menu

A

h1, .menu {

…..

}

127
Q

which property do you use to change the typeface on your webpage?

A

font-family:

128
Q

what is the term of a group of fonts supported across most browsers and OS’s

A

web safe fonts

129
Q

when a font is more than one word, what do you do?

A

h1 {

font-family : “ Courrier New “ ;

}

enclose in quotes

130
Q

which property do you use to change the font size?

A

p {

font-size : 18 px ;

}

131
Q

which property do you use to change how bold or thin font appears?

A

p {

font-weight : bold ;

}

132
Q

which property do you use to align text and where is it aligned to?

A

p {

text-align : right ;

}

it will align text in reference to its parent

133
Q

what are the values for text-align?

A

left, right, center, or justify

134
Q

which property styles an elements foreground color:

A

p {

color : red ;

}

135
Q

which property styles an elements background color?

A

p {

background-color : red ;

}

136
Q

how to measure how transparent an element is

A

0 to 1

1 - 100% fully visible

0 - 0 % fully invisible

137
Q

code for 50% opacity

A

.overlay {

opacity : 0.5 ;

}

138
Q

code for a background as an image

A

.main-banner {

background - image : url ( “ https://www. … .jpg “ ) ;

}

139
Q

code for a background image with a relative path

A

.main-banner {

background - image : url ( “ images / mountains . jpg “ ) ;

}

140
Q

what will override any particular style and should almost never be used?

A

p {

color : blue ; ! important ;

}

141
Q

what is meant by the box model?

A

all elements on a web page are interpreted by the browser as “living” inside of a box.

142
Q

what are the boxes elements from innermost to outermost?

A

content, padding, border, and margin

143
Q

height and width can be used to modify which element of the box model?

A

the content

p {

height : 80 px ;

width : 240 px ;

}

144
Q

what happens when the width and height of an element are set in pixels?

A

it will be the same size on all devices

145
Q

what is a border in css?

A

a border is a line that surrounds an element

146
Q

code for a border 3 px wide that has a solid line and is colored coral

A

p {

border : 3 px solid coral ;

}

147
Q

which element will allow you to modify the corners of a border?

A

border-radius :

148
Q

a perfect circle uses a border-radius of what percent?

A

border-radius : 50 % ;

149
Q

what is the area between the contents of a box and its border?

A

padding :

150
Q

code for a padding of 10 px’s on all 4 sides

A

p {

padding : 10 px ;

}

151
Q

how can you be most specific when coding paddings

A

padding-top :

padding-right :

padding-bottom :

padding-left :

152
Q

padding shorthand with 4 values mean what?

A

p {

padding : 6px 11px 4px 9px ;

}

from top moving clockwise, right, bottom then left

153
Q

padding shorthand when using 3 values

A

p {

padding : 5px 10px 20px ;

}

when right and left side padding equal

154
Q

padding shorthand when using 2 values

A

p {

padding : 5px 10px ;

}

top and bottom equal and right and left equal

155
Q

what is the space outside of the border seperating elements on the page?

A

this is called the margin

156
Q

code for a margin of 20 px’s all around

A

p {

margin : 20 px ;

}

157
Q

be specific for margins

A

margin-top :

margin-right :

margin-bottom :

margin-left :

158
Q

what can be said about margin shorthand for 4, 3, 2, and 1 values

A

they totally mimic padding shorthand

159
Q
A