CSS Flashcards

1
Q

What does CSS stand for?

A

Cascading Styles Sheets

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

What are the two different methods or syntax for writing CSS code?

A

CSS ruleset and CSS inline style

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

What is a selector? (Ruleset)

A

A selector is the beginning of the ruleset used to target the element that will be styled.

Ex:
p {
color: blue;
}

p = the selector

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

What is a declaration block? (Ruleset)

A

The code in-between (and including) the curly braces ({ }) that contains the CSS declaration(s).

p {
color: blue;
}

The declaration block = {color: blue:)}

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

What is a declaration? (Ruleset)

A

The group name for a property and value pair that applies a style to the selected element.
p {
color: blue;
}

The declaration = color: blue;

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

What is a property? (Ruleset)

A

The first part of the declaration that indicates the aspects of the element you want to change. For example, color, font, width, height and border.

p {
color: blue;
}

property = color

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

What is a value? (Ruleset)

A

The second part of the declaration. Values specify the settings you want to use for the chosen properties. For example, if you want to specify a color property then the value is the color you want the text in these elements to be.

p {
color: blue;
}

value = blue

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

Style attribute

A

The style attribute is used to add CSS inline styles to an HTML element.

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

What do we often call the CSS code inside the <style> element in a html file?</style>

A

internal stylesheet

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

How do we link html and css files?

A

use the link element to link HTML and CSS files together. The link element must be placed within the head of the HTML file. It is a self-closing tag and requires the following attributes:

  1. href
  2. rel -this attribute describes the relationship between the HTML file and the CSS file. Because we are linking to a stylesheet, the value should be set to stylesheet.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does the type selector do?

A

A selector is used to target the specific HTML element(s) to be styled by the declaration. The type selector matches the type of the element in the HTML document.

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

What is the type selector also referred to as?

A

The type selector is sometimes referred to as the tag name or element selector.

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

What does the universal selector do?

A

The universal selector selects all elements of any type. The universal selector uses the * character
* {
font-family: Verdana;
}

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

What is a common way for selecting an element when working with html and css?

A

Using the class attribute.

Ex:
p class=’brand’ Sole Shoe Company /p

Important note: Greater than/less than have been removed in code above.

.brand {

}

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

How can we add multiply classes to an html element?

A

We can add multiple classes to an HTML element’s class attribute by separating them with a space.

Ex:

.green {
color: green;
}

.bold {
font-weight: bold;
}

h1 class=’green bold’

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

What do we use to when we want to give an html element its own unique style?

A

large-title {

We use the id attribute.
h1 id=’large-title’ …./h1

Important note: Greater than/less than have been removed in code above.

}

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

How is the class attribute different than the id attribute?

A

The class attribute accepts multiple values and can be used broadly throughout an HTML document. The element’s id can only have a single value and can only be used once per page.

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

What is the attribute selector?

A

Attribute selectors allow you to create rules that apply to elements that have an attribute with a specific value.

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

What is one advantage of using the attribute selector compared to class or id?

A

When we use the attribute selector we do not need to write any new code (new html markup- id or class)

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

What are pseudo-class selectors?

A

Pseudo-class selectors allow you to change the appearance of elements when a user is interacting with them.

For example: When you’re filling out a form and the submit button is grayed out and disabled. But when all of the fields have been filled out, the button has color showing that it’s active.

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

:hover

A

This is applied when a user hovers over an element with a pointing device such as a mouse. Commonly used to change the appearance of links and buttons when a user places their cursor over them.

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

:active

A

Active is applied when an element is being activated by a user (a button being pressed or link being clicked). Makes the user “feel” like it is being pressed.

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

:focus

A

This is applied when an element has focus. Any element that you can interact with (link, form) can have focus. It is generally triggered when the user clicks or taps on an element or selects it with the keyboard’s tab key.

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

:visited

A

Visited represents links that the user has already visited. For privacy reasons, the styles that can be modified using this selector are very limited.

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

Why should ID’s be used sparingly?

A

ID’s should be used sparingly because IDs override the styles of types and classes. We should only use them on elements that need to always appear the same.

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

What is specificity?

A

Specificity is the order by which the browser decides which CSS styles will be displayed.

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

What is a best practice in regards to specificity?

A

A best practice in CSS is to style elements while using the lowest degree of specificity so that if an element needs a new style, it is easy to override.

It’s best to style with a type selector, if possible. If not, add a class selector. If that is not specific enough, then consider using an ID selector.

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

What is chaining?

A

Chaining is when we combine multiply selectors in the CSS stylesheet.

For example:

h1.special {

}

This code will only affect the h1 element that has the class special. If we had a p element with the class special it would not be styled.

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

What is the descendant combinator?

A

The descendant combinator is a selector that allows us to select elements that are nested within other elements.

Example:

.main-list li {

}

This will select the element with the class main-list (ul) and then the descendant element (li). Must include a space between the class name and descendant element.

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

How can we increase the specificity of a CSS selector?

A

We can add more specificity by adding more than one tag, class, or ID to a CSS selector.

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

How do you add CSS styles to multiple selectors all at once?

A

We can separate the selectors by a comma to apply the same style to many selectors at once.

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

font-family property

A

The font-family property is used to change the typeface on your webpage.

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

What should you keep in mind when setting the font on your web page?

A
  1. The font must be installed on the users computer or downloaded with the site.
  2. Use web safe fonts -a group of fonts supported across most browsers and operating systems.
    3.Unless you are using web safe fonts, the font you choose may not appear the same on all browsers and operating systems.
    4.When the name of a typeface consists of more than one word, it’s a best practice to enclose the typeface’s name in quotes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

font-size property

A

We use the font-size property to change the size of text on the web page.

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

font-weight property

A

The font-weight property controls how bold or thin text appears.

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

Why does the font-weight value “normal” exist?

A

If we were to make all of the text bold, we could use the normal value to make a specific part of the text not bold.

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

text-align property

A

To align text we can use the text-align property. The text-align property will align text to the element that holds it, otherwise known as its parent.

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

color property

A

The color property styles an element’s foreground color.

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

background-color property

A

The background-color property styles an element’s background color.

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

opacity

A

Opacity is the measure of how transparent an element is. It’s measured from 0 to 1, with 1 representing 100%, or fully visible and opaque, and 0 representing 0%, or fully invisible.

The opacity property can be used to make elements fade into others for a nice overlay effect.

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

background-image

A

The background-image property will set the element’s background to display an image. The value provided is a url.

Ex:
.main-banner {
background-image: url(‘images/mountains.jpg’);
}

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

!important

A

!important can be applied to specific declarations, instead of full rules. It will override any style no matter how specific it is. As a result, it should almost never be used.

One justification for using !important is when working with multiple stylesheets.

Ex:

p {
color: blue !important;
}

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

What is the box model?

A

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

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

What does the box model include?

A

The model includes:
1.The content area’s size (width and height)
2.The element’s padding, border, and margin.

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

width and height (box model)

A

The width and height of the content area.

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

Padding (box model)

A

The amount of space between the content area and the border. Padding is like the space between a picture and the frame surrounding it.

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

Border (box model)

A

The thickness and style of the border surrounding the content area and padding. Like a frame around a painting.

Borders can be set with a specific width, style, and color

Ex:

p {
border: 3px solid coral;
}

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

Margin (box model)

A

The amount of space between the border and the outside edge of the element.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
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 — an element that fills a laptop screen will overflow a mobile screen.

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

What are the different parameters for a border’s width?

A

A border’s thickness can be set in pixels or with one of the following keywords: thin, medium, or thick.

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

What are the different parameters for a border’s style?

A

Web browsers can render any of 10 different styles. These styles include: none, hidden, dotted, dashed, double, groove, ridge, inset, outset, and solid.

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

What are the different parameters for a border’s color?

A

The color of the border. Web browsers can render colors using a few different formats, including 140 built-in color keywords.

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

What is the default border in CSS?

A

medium, none, color Where color is the current color of the element.

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

How can you modify the corners of an element’s border box?

A

You can modify the corners of an element’s border box with the border-radius property.

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

How can you create a border that is a perfect circle?

A

You can create a border that is a perfect circle by first creating an element with the same width and height, and then setting the radius equal to half the width of the box, which is 50%.

Ex:
div.container {
height: 60px;
width: 60px;
border: 3px solid blue;
border-radius: 50%;
}

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

How can you be more specific about the amount of padding on each side of a box’s content?

A

You can use the following properties:
1. padding-top
2. padding-right
3. padding-bottom
4. padding-left

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

What is a shorthand property?

A

A shorthand property is a declaration that uses multiple properties as values.

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

What is padding shorthand?

A

Padding shorthand allows you to specify all of the padding properties as values on a single line.

You can specify these properties using 4, 3, or 2 values.

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

Padding shorthand with four values

A

The amount of padding for each section is specified in a clockwise rotation: top, right, bottom, left.

Example:

p.content-header {
padding: 6px 11px 4px 9px;
}

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

Padding shorthand with three values

A

This is used when the amount of padding is equal for the left and right sides. The first value sets the padding-top value (5px), the second value sets the padding-left and padding-right values (10px), and the third value sets the padding-bottom value (20px).

Example:

p.content-header {
padding: 5px 10px 20px;
}

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

Padding shorthand with two values

A

This shorthand is used when the top and bottom sides are equal and the left and right sides are equal. The first value sets the padding-top and padding-bottom values (5px), and the second value sets the padding-left and padding-right values (10px).

Example:
p.content-header {
padding: 5px 10px;
}

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

How does margin shorthand work?

A

Margin shorthand uses all of the same syntax as padding shorthand (4 values, 3 values, 2 values)

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

How can you center content using the margin property?

A

You can center content using the margin property by making sure you set a width and using the syntax 0 auto for the margin property.

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

What does the 0 auto syntax (margin: 0 auto) do when using the margin property?

A

The 0 sets the top and bottom margins to 0 pixels. The auto value tells the browser to adjust the left and right margins until the element is centered within its containing element.

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

What are the top and bottom margins also called?

A

vertical margins

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

What are the left and right margins also called?

A

horizontal margins

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

What is one big difference between vertical and horizontal margins?

A

Vertical margins collapse and horizontal margins do not. If we have two elements with the top margin of one set to 20px and the bottom margin of the other set to 30px, the margin will only be dependent on the larger margin (the margin will be 30px).

Horizontal margins will combine. Element 1 margin-right is 30 px and Element 2 margin-left is 30 px, total space between them will be 60px.

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

Why do we use min-width and max-width properties?

A

Content, like text, can become difficult to read when a browser window is narrowed or expanded. These two properties ensure that content is legible by limiting the minimum and maximum widths of an element.

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

How can you limit the minimum and maximum height of an element?

A

Using the min-height and max-height properties.

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

overflow property

A

The overflow property controls what happens to content that spills, or overflows, outside its box.

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

What are the most common values for the overflow property?

A
  1. display
  2. scroll
  3. hidden
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
72
Q

What is the hidden value for the overflow property?

A

The overflow value will allow any content that overflows will be hidden from view.

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

What is the scroll value for the overflow property?

A

The scroll value will add a scrollbar to the element’s box so that the rest of the content can be viewed by scrolling.

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

What is the visible value for the overflow property?

A

The visible value will allow the overflow content will be displayed outside of the containing element.

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

What are user agent stylesheets?

A

Default stylesheets the major browser have. In this case, the term user agent is a technical term for the browser.

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

How can developers reset the default stylesheet values?

A

By using the code below, which resets the default margin and padding values of all HTML elements. It is often the first CSS rule in an external stylesheet.
Note that both properties are set to 0. When these properties are set to 0, they do not require a unit of measurement

  • {
    margin: 0;
    padding: 0;
    }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
77
Q

What does the box-sizing property control?

A

It controls the type of box model the browser should use when interpreting a web page.

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

What is the default value for the box -sizing property?

A

content-box

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

How can we reset the entire box model and specify a new one?

A

By setting the box-sizing property to border-box.

80
Q

Why is the border-box value important?

A

The border-box value ensures that the the height and width of the box will remain fixed. (padding and the boarder will not add to the width or height of the box).

81
Q

What are block- level elements?

A

Block-level elements are elements that create a block the full width of their parent elements, and they prevent other elements from appearing in the same horizontal space.

82
Q

How can we change the default position of an element?

A

We can change the default position of an element by using the position property.

83
Q

What are the five values for the position property?

A

static, relative, absolute, fixed, sticky

84
Q

What is the default value for the position property?

A

static

85
Q

What does the relative value for the position property allow you to do?

A

The relative value allows you to position an element relative to its default static position on the web page.

86
Q

What must you add to the position declaration?

A

You must add an offset property (top, bottom, left, right) to indicate where the element should be positioned on the page.

Ex:
postion: relative:
top: 50px;
left: 50px;

87
Q

What type of values can you use for the offset property (related to size)?

A

Pixels, rem, percentages

Ex:
postion: relative:
top: 50px;
left: 50px;

88
Q

Does relative positioning affect the positioning of other elements?

A

no

89
Q

What does the absolute value for the position property allow you to do?

A

The absolute value allows you to position the element relative to it’s closest parent element using the offset properties.

90
Q

What does the fixed value for the position property allow you to do?

A

fix an element to a specific position on the page (regardless of user scrolling)

Example:
header {
position: fixed;
top: 0px;
left: 0px;
}

91
Q

What’s a website feature that commonly uses the fixed value for position?

A

Navigation bars

92
Q

What does the sticky value for the position property allow you to do?

A

The sticky value allows an element to behave like a relatively-positioned element until it reaches a certain point and then starts behaving like a statically-positioned element (“stick at that point)

93
Q

What does the z-index property control?

A

The z-index property controls how far back or how far forward an element should appear on the web page when elements overlap.

Note: The larger z-index with overlap the smaller index (1 vs 0 or 10 vs unidentified)

94
Q

What type of values does the z-index property accept?

A

integers

95
Q

What does the display property do?

A

The display property controls if an element is treated as a block or inline element and the layout used for its children (flow layout, grid or flex)

96
Q

What are three values for the display property?

A

inline, block, inline-block

97
Q

What are inline elements?

A

Inline elements have a box that wraps tightly around their content and only take up the amount of space necessary to display their content. They also do not require a new line after each element.

98
Q

What can we not alter with inline elements?

A

We can not alter the size of inline elements (height and width)

99
Q

How can we get block elements to be displayed as inline elements?

A

We can make any element an inline element by using the display property.

Ex:

h1 {
display: inline;
}

100
Q

What are block-level elements?

A

Block-level elements are elements that fill the entire width of the page by default (width can be changed using css).

101
Q

What is the default height for block-level elements?

A

Unless we manually change it, they are the height necessary to contain their content.

102
Q

What are some examples of block-level elements?

A

headings, , paragraphs, divs, footer, address, article, aside, block quote, details, dialogue, description list, field set, figure caption, figure, etc.

103
Q

What does the inline-block element allow?

A

The inline-block element allows you to combine features of both inline and block elements. Inline-block elements can appear next to each other and we can specify their dimensions using the width and height properties.

104
Q

What are the best examples of default inline-block elements?

A

images

105
Q

What is the float property commonly used for?

A

The float property is commonly used for wrapping text around an image.

106
Q

The float property is often set using what values?

A

left - moves, or floats, elements as far left as possible.
right - moves elements as far right as possible.

107
Q

What should we include to make sure the float property is actually visible?

A

A specified width

108
Q

What is the clear property used for?

A

The clear property specifies how elements should behave when they bump into each other on the page.

109
Q

What are the values the clear property can take?

A

left- left side of element can not touch with any other element in the parent element)
right- right side of element can not touch with any other element in the parent element
both - neither side of the element can touch with any other element in the parent element
none—the element can touch either side.

110
Q

What are the three ways we can describe colors in CSS?

A
  1. Named colors — English words that describe colors, also called keyword colors
  2. RGB — numeric values that describe a mix of red, green, and blue
  3. HSL — numeric values that describe a mix of hue, saturation, and lightness
111
Q

What is the foreground color?

A

Foreground color is the color that an element appears in.

112
Q

What does the color property do?

A

The color property styles an element’s foreground color.

113
Q

What does the background-color property do?

A

The background-color property styles an element’s background color.

114
Q

What do the characters in a hex color represent?

A

The characters represent values for red, blue and green.

115
Q

What do hex colors begin with?

A

A hex color begins with a hash character (#)

116
Q

What is hex short for and what is it?

A

Hexadecimal. Hexadecimal is a number system that has sixteen digits, 0 to 9 followed by “A” to “F”

117
Q

How many digits does the hexadecimal system have?

A

16 (0-15)

118
Q

How are RGB colors and hex colors different?

A

RGB colors use decimal numbers instead of hexadecimal numbers.

119
Q

What do each of the three values in a RGB color represent?

A

Each of the three values represents a color component, and each can have a decimal number value from 0 to 255.

The first number represents the amount of red, the second is green, and the third is blue.

120
Q

What does the syntax for a RGB color look like?

A

h1 {
color: rgb(143, 188, 143);
}

121
Q

What does HSL stand for?

A

hue-saturation-lightness color scheme

122
Q

What do each of the three values in a HSL color represent?

A

1st number -represents the degree of the hue (can be between 0 and 360)
2nd number - saturation (percentages)
3rd number- lightness (percentages)

123
Q

What is the syntax for a HSL color?

A

h1 {
color: hsl(120, 60%, 70%);
}

124
Q

What is hue?

A

Hue refers to an angle on a color wheel. Red is 0 degrees, Green is 120 degrees, Blue is 240 degrees, and then back to Red at 360.

125
Q

What is saturation?

A

Saturation is the intensity or purity of the color. The saturation increases towards 100% as the color becomes richer. The saturation decreases towards 0% as the color becomes grayer.

126
Q

What is lightness in terms of HSL color?

A

Lightness refers to how light or dark the color is. Halfway, or 50%, is normal lightness. Imagine a sliding dimmer on a light switch that starts halfway.

Sliding towards 100% brings closer to white. Sliding down towards 0% brings closer to black.

127
Q

What’s a major benefit of HSL colors?

A

HSL makes it easy to adjust colors (change the lightness, saturation, or hue).

128
Q

What does opaque mean?

A

Non-transparent

129
Q

What is opacity?

A

Opacity is the amount of transparency and element has.

130
Q

How can we use opacity in the HSL color scheme?

A

by adding alpha (a) at the end of the hsl syntax (hsla)

131
Q

What is the syntax for HSL with opacity?

A

h1 {
color: hsla(34, 100%, 50%, 0.1);
}

132
Q

What is alpha?

A

Alpha or opacity is a decimal number from 0 to 1.
0 = completely transparent
1 = opaque
0.5 = half transparent

133
Q

How can we add transparency to a RGB value.

A

by adding alpha at the end of the rgb syntax (rgba).

Example:

h1 {
color: rgba(234, 45, 98, 0.33);
}

134
Q

What can alpha (opacity) not be used with?

A

Named colors

135
Q

How can we add opacity to hex values?

A

By adding a two-digit hexadecimal value to the end of the six-digit representation (#52BC8280), or a one-digit hexadecimal value to the end of the three-digit representation (#F003)

Hex opacity ranges from 00 (transparent) to FF (opaque).

136
Q

What is the named color keyword for zero opacity and what is it’s syntax?

A

transparent
Syntax:

h1 {
color: transparent;
}

137
Q

When can hex colors be abbreviated?

A

Hex colors can be abbreviated when both characters of all three values colors are repeated.
Example:
#0000ff can be abbreviated by #00f

138
Q

What property do we learn to change the font?

A

font-family

h1 {
font-family: Arial;
}

139
Q

What should we use when using a typeface with multiple words, like Times New Roman?

A

We should use quotation marks (‘ ‘) to group the words together.

Example:
h1 {
font-family: ‘Times New Roman’;
}

140
Q

What are web safe fonts?

A

Fonts that appear the same across all browsers and operating systems.

141
Q

What is a font stack?

A

A font stack usually contains a list of similar-looking fonts.

Example:
h1 {
font-family: Caslon, Georgia, ‘Times New Roman’;
}

142
Q

What’s a fall back font?

A

Web safe fonts that can be used if your preferred font is not available.

143
Q

What is the difference between Serif and Sans-serif fonts?

A

Serif fonts have extra details (feet at the bottom) on the ends of each letter, as opposed to Sans-Serif fonts, which do not have the extra details.

144
Q

What keywords can also be used as a final fallback font if nothing else in the font stack is available.

A

Serif and Sans-Serif

145
Q

What keyword values can the font-weight property take?

A
  1. bold: Bold font weight.
  2. normal: Normal font weight. This is the default value.
  3. lighter: One font weight lighter than the element’s parent value.
  4. bolder: One font weight bolder than the element’s parent value
146
Q

What’s the range for numerical values that the font-weight property can take?

A

Numerical values can range from 1 (lightest) to 1000 (boldest)

147
Q

What is the common practice when using numerical values for the font-weight property?

A

Common practice to use increments of 100.
400 = normal
700 = bold

148
Q

font-weight syntax with numerical values

A

.left-section {
font-weight: 700;
}

149
Q

font-weight syntax with keyword values

A

.right-section {
font-weight: bold;
}

150
Q

How can you italicize text using css?

A

You can italicize text with the font-style property.

151
Q

What is the syntax for italicize? (CSS)

A

h3 {
font-style: italic;
}

152
Q

How can we make text appear in all uppercase or lowercase?

A

By using the text-transform property?

153
Q

What is the syntax for making text appear all uppercase or lowercase?

A

h1 {
text-transform: uppercase;
}

*we can also replace the uppercase keyword with lowercase

154
Q

Why should we use CSS to make text appear in all uppercase/lowercase and not simply type it in our html file?

A

Depending on the type of content a web page displays, it may make sense to always style a specific element in all uppercase or lowercase letters. (breaking news)

It also helps avoiding uppercase text in the HTML file, which could make code difficult to read.

155
Q

What does the letter-spacing property do?

A

The lettering-spacing property allows us to set the horizontal spacing between the individual characters in an element.

156
Q

What is the syntax used for setting the horizontal spacing between the individual characters in an element?

A

p {
letter-spacing: 2px;
}

157
Q

What are the values that the letter-spacing property can take?

A

The letter-spacing property takes length values in units, such as 2px or 0.5em.

158
Q

Is it common to increase the spacing between words and characters in words?

A

No, but it may help enhance the readability of bolded or enlarged text.

159
Q

What value is recommended for word spacing?

A

For word spacing, using em values are recommended because the spacing can be set based on the size of the font.

160
Q

What does the word-spacing property do?

A

The word spacing property sets the space between words.

161
Q

What does the line-height property do?

A

The line-height property sets how tall we want each line containing our text to be.

162
Q

What type of values can the line-height property take?

A

Line height values can be a unitless number, such as 1.2, or a length value, such as 12px, 5% or 2em.

163
Q

What is the syntax for line-height?

A

p {
line-height: 1.4;
}

164
Q

What value is preferred for line-height?

A

Generally, the unitless value is preferred since it is responsive based on the current font size. (Changing the font-size will will automatically readjust the line height)

165
Q

How can we use font services like Adobe fonts, Google fonts, and fonts.com?

A

We can use the services by using the link element. These services host fonts that you can link to from your HTML document

166
Q

How do you use Google Fonts?

A
  1. Go to Google Fonts online.
  2. Select the font you want.
  3. In the list of style variations pick the style you prefer.
  4. Click “+ Select this style”
    5.Copy the provided <link></link> element, and paste it into the <head> element inside index.html.
167
Q

What is @font-face?

A

The at @font-face ruleset can be used to add fonts to the CSS stylesheet.

168
Q

What are the different file formats for web fonts?

A

OTF (OpenType Font)
TTF (TrueType Font)
WOFF (Web Open Font Format)
WOFF2 (Web Open Font Format 2)

169
Q

What should we include with our @font-face rule to ensure compatibility on all browsers?

A

We should include TTF, WOFF, and WOFF2 formats

170
Q

Why should we include different formats with our @font-face rule?

A

The different formats are a progression of standards for how fonts will work with different browsers, with WOFF2 being the most progressive.

171
Q

Where should we define the @font-face ruleset?

A

at the top of your CSS stylesheet.

172
Q

What is the syntax for defining the @font-face ruleset?

A

@font-face {
font-family: ‘MyParagraphFont’;
src: url(‘fonts/Roboto.woff2’) format(‘woff2’),
url(‘fonts/Roboto.woff’) format(‘woff’),
url(‘fonts/Roboto.ttf’) format(‘truetype’);
}

*font-family property is used to set a custom name for the downloaded font.

173
Q

What is the syntax for using the @font-face ruleset once it is defined?

A

p {
font-family: ‘MyParagraphFont’, sans-serif;
}

174
Q

What is the difference between CSS ruleset and a CSS rule?

A

There is no difference - both mean a style rule, which is a qualified rule that associates a selector list with a list of property declarations and possibly a list of nested rules in CSS.

175
Q

Name one way of selecting by type and/or attribute values.

A

One way is by using type[attribute*=value]. In short, this code selects an element where the attribute contains any instance of the specified value.

176
Q

What are pseudo-classes in CSS?

A

A CSS pseudo-class is a keyword added to a selector that specifies a special state of the selected element(s). For example, the pseudo-class :hover can be used to select a button when a user’s pointer hovers over the button and this selected button can then be styled.

177
Q

What is overflow-x property?

A

The overflow-x CSS property sets what shows when content overflows a block-level element’s left and right edges. This may be nothing, a scroll bar, or the overflow content. This property may also be set by using the overflow shorthand property.

178
Q

What is overflow-y property?

A

The overflow-y CSS property sets what shows when content overflows a block-level element’s top and bottom edges. This may be nothing, a scroll bar, or the overflow content. This property may also be set by using the overflow shorthand property.

179
Q

Explain the visibility property and give its three possible values.

A

Elements can be hidden from view with the visibility property.

The visibility property can be set to one of the following values:
hidden — hides an element.
visible — displays an element.
collapse — collapses an element.

180
Q

What’s the difference between display: none and visibility: hidden?

A

An element with display: none will be completely removed from the web page. An element with visibility: hidden, however, will not be visible on the web page, but the space reserved for it will.

181
Q

What is the difference between the default box model and the new border-box model?

A

In the default box model, box dimensions are affected by border thickness and padding, the border-box model is not affected by border thickness or padding.

182
Q

How do you implement the new box model?

A
  • {
    box-sizing: border-box;
    }
183
Q

What is the cursor property?

A

The cursor CSS property sets the mouse cursor, if any, to show when the mouse pointer is over an element.

184
Q

Name main states for links.

A

Links have four main states: normal (not clicked), hover, active (clicked), and visited. These four states have associated CSS pseudo-classes: :link, :hover, :active, and :visited. These four states can be used to give a full range of visual feedback to users about the status of their link interaction.

185
Q

What is skeuomorphism?

A

The concept of UI elements that replicate or imitate real-life counterparts.

186
Q

What is flat design?

A

Flat design is an alternative approach to skeuomorphism that embraces the fact that computer interfaces do not necessarily need to model real-life interfaces. As users grow more familiar with digital displays and interfaces, designers have felt less need to model physical interactions and instead rely on other signifiers to indicate interactive elements. To generalize, flat design uses simplicity and lack of clutter for its UI elements.

187
Q

What is the proper order of link states?

A

The proper order of these rules is:

:link
:visited
:hover
:active

188
Q

What is + in CSS?

A

The + is called the adjacent sibling combinator; it will only select two li‘s when they are immediately next to each other, with the same parent. The element that actually gets selected is the second element of this sibling pair.

189
Q

::before

A

The ::before part of this selector creates a pseudo-element. The ::before pseudo-element is often used with the content property, to add content that will be displayed just before the selected element.

190
Q

What are the breadcrumb types?

A

There are three major types of breadcrumbs:

Location
Attribute
Path

191
Q

What are location breadcrumbs?

A

Location based breadcrumbs are based on where you are with respect to the navigation structure of the website. In our previous shoe shopping example, the first three li elements are location based. We are in the “shoes” section of the website, which is contained within the “fashion” section, which is contained within the “shopping” section.

192
Q

What are attribute breadcrumbs?

A

Attribute based breadcrumbs are based on the attributes of the page or product that you are browsing. In our previous example, the final two li elements are attribute based. We are shopping for shoes that are “flats” and “brown”. Since the order of these attributes is not prescriptive, you’ll see some sites display these at the same level in the UI. If you want to allow users to remove attributes, provide an (x) button or similar to indicate they can be removed.

193
Q

What are path breadcrumbs?

A

Breadcrumbs can be based on a user’s unique path through the site. For example, if they landed on the home page, browsed to the about page and finally the registration page, their breadcrumb trail may look like:

Home > About > Register

Note that this breadcrumb trail will be different for each user and each visit. For even mildly complex sites, the number of steps will become large. To simplify the display, the beginning of the trail is often abbreviated:

… > About > Register

194
Q

What does a > symbol means in css when used with selecto?

A

The greater than sign (>) selector in CSS is used to select the element with a specific parent. It is called as element > element selector. It is also known as the child combinator selector which means that it selects only those elements which are direct children of a parent.

P > SPAN means applying the style that follows to all SPAN tags that are children of a P tag.

Note that “child” means “immediate descendant”, not just any descendant. P SPAN is a descendant selector, applying the style that follows to all SPAN tags that are children of a P tag or recursively children of any other tag that is a child/descendant of a P tag. P > SPAN only applies to SPAN tags that are children of a P tag.

195
Q

What does a + symbol means in css?

A

The + sign is best known as an adjacent sibling combinator, which means it separates two selectors, then combines the second selector with other elements which are placed immediately after the chosen selector. The + sign selector is used when the user wants to have the same styling for different elements.

196
Q

Compound selector

A

Compound selector
A sequence of simple selectors that are not separated by a combinator. A compound selector represents a set of simultaneous conditions on a single element. A given element is said to match a compound selector when the element matches all the simple selectors in the compound selector.

In a compound selector, the type selector or a universal selector in a compound selector must come first in the sequence of selectors. Only one type selector or universal selector is allowed in the sequence. Since whitespace represents the descendant combinator, no whitespace is allowed between the simple selectors in a compound selector.

Example: a#selected {…}