Chapter 12 Flashcards

1
Q

CSS-wide keywords (general)

A

All CSS properties accept the three CSS-wide keywords: initial, inherit, and unset. Because they are shared by all properties, they are not listed with the values for individual property listings.

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

CSS-wide keywords (initial)

A

Explicitly sets the property to its default (initial) value.

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

CSS-wide keywords (inherit)

A

Allows you to explicitly force an element to inherit a style property from its parent. This may come in handy to override other styles applied to that element and to guarantee that the element always matches its parent.

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

CSS-wide keywords (unset)

A

Erases declared values occurring earlier in the cascade, setting the property to either inherit or initial, depending on whether it inherits or not.

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

Font-family (properties)

A

Use the font-family property to specify a font or list of fonts.

Values: one or more font or generic font family names, separated by commas
Default: depends on the browser
Applies to: all elements
Inherits: yes

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

Font-family syntax requirements

A

All font names, with the exception of generic font families, must be capitalized.

For example, use Arial instead of arial.
Use commas to separate multiple font names. Notice that font names that contain a character space must appear within quotation marks.

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

Font limitations (fallback)

A

If the browser can’t find your first choice of font (for example, if that font is not installed on the user’s computer or the provided web font fails to load), the browser uses its default font instead. To avoid this, CSS allows us to provide a list of back-up fonts should our first choice not be available. If the first specified font is not found, the browser tries the next one, and down through the list until it finds one that works. A generic font is applied at a last attempt.

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

The 5 Generic font family catagories

A

Serif, Sans Serif, Monospace, Cursive, and Fantasy are the 5 stylistic categories.

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

Generic font-family: Serif

A

Serif typefaces have decorative slab-like appendages (serifs) on the ends
of certain letter strokes.

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

Generic font-family: Sans-serif

A

Sans-serif typefaces have straight letter strokes that do not end in serifs.

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

Generic font-family: Monospace

A

In monospace (also called constant width) typefaces, all characters take up the same amount of space on a line.

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

Generic font-family: Cursive

A

Cursive fonts emulate a script or handwritten appearance.

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

Generic font-family: Fantasy

A

Fantasy fonts are purely decorative and would be appropriate for headlines and other display types.

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

Best practice for specifying fonts for web pages (fallback)

A

Start with your first choice, provide some similar alternatives, and then end with a generic font family that at least gets users in the right stylistic ballpark. A good font stack should include stylistically related fonts that are known to be installed on most computers.

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

Font-size (properties)

A

Values: length unit | percentage | xx-small | x-small | small | medium | large |
x-large | xx-large | smaller | larger

Default: medium
Applies to: all elements
Inherits: yes

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

Can specify size (in font-size) using… (4)

A
  1. CSS length units (em).
  2. Percents.
  3. Absolute keywords (xx-small, x-small, small, medium/default, large, x-large, xx-large).
  4. Relative keyword (larger or smaller) in relation to surrounding text.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Preferred sizing values (and non-preferred)

A

Preferred are em, rem, %. Can use px, but do not provide flexibility required. Unless creating for print, all other absolute units are out.

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

To maintain the browser’s default size…

A

Set the font-size of the root element to 100%. It is also common practice to set the body to 100%, but setting it on the html element is a more flexible approach.

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

Rem values

A

The rem unit, which stands for “root em,” is always relative to the size of the root (html) element. Because relative to the same element, they are the same size in the document and work like absolute. But, will resize proportionally if root is resized. Best of both worlds.

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

Em values

A

Em units are based on the font size of the current element. It will be relative to the inherited size for that element. Once the em is calculated for an element, it can be used for other measurements as that you want to always be relative to the size of the font.

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

Em values warning

A

Inconsistency, rounding errors on some platforms/browsers. Also, they are based on the inherited size of the element, which means that their size is based on the context in which they are applied. If you have elements nested several layers deep, the size increase or decrease compounds, which can create problems.

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

Percentage values (font-size)

A

Works by creating a size as a percentage of the specified default size.

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

To calculate % and em values, use this formula:

A

target size ÷ size of context = result.

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

Keywords (font-size)

A

The keywords do not correspond to particular measurements, but rather are scaled consistently in relation to one another.

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

Relative keywords (font-size)

A

Used to shift the size of text relative to the size of the parent element text. The exact amount of the size change is determined by each browser and is out of your control.

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

Font-weight (properties)

A

Values: normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800| 900
Default: normal
Applies to: all elements
Inherits: yes

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

Font-weight definition/basics

A

If you want a text element to appear in bold, use the font-weight property to adjust the boldness of type. Uses descriptive terms and 9 numeric values. 600+ is bold. Normal is to unbold a font that is naturally bold.

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

Font-style (Italics) (properties)

A

Values: normal | italic | oblique
Default: normal
Applies to: all elements
Inherits: yes

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

Oblique warning

A

There is an oblique value that specifies a slanted version of the font; however, browsers generally display oblique exactly the same as italic.

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

Font-style (Italics) definition/basics

A

The font-style property affects the posture of the text—that is, whether the letter shapes are vertical (normal) or slanted (italic and oblique). A common use is to make text that is italicized in the browser’s default styles display as normal.

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

Font-variant CSS2.1 (properties)

A

Some typefaces come in a “small caps” variant. This is a separate font design that uses small uppercase-style letters in place of lowercase letters. Small caps characters are designed to match the size and density of lowercase text so they blend in. 3 or more capital letters in the flow of text- abbreviations or time.

Browsers simulate small caps by scaling down uppercase letters in the current font. To typography sticklers, this is less than ideal and results in inconsistent stroke weights.

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

Font-stretch definition/basics

A

Tells the browser to select a normal, condensed, or extended font in the font family. If browser cannot find a matching font, it will not try to synthesize the width by stretching/squeezing text; it may just substitute a font of a different width.

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

Font-stretch (properties)

A

Values: normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded |ultra-expanded

Default: normal
Applies to: all elements
Inherits: yes

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

Shortcut font Property

A

Compiles all the font-related properties into one rule. The value of the font property is a list of values for all the font properties we just looked at, separated by character spaces. Order of values IS important. Must include font-size and font-family in that order- omitting one or putting them in the wrong order. No requirements after those two.

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

Shortcut font (properties)

A

Values: font-style I font-weight I font-variant I font-stretch I font-size/line-height I font-family | caption | icon | menu | message-box | small-caption | status-bar

Default: depends on default value for each property listed
Applies to: all elements
Inherits: yes

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

Keyword values (shortcut font)

A

The font property also has a number of keyword values that represent system fonts, the fonts used by operating systems for things like labels for icons and menu items.

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

Font-variant CSS3 definition/basics

A

CSS3 Font Module greatly expanded the definition of font-variant. Now it can serve as a shorthand property for a number of font-variant- prefixed properties. These properties are still considered experimental. Nice to have but okay to lose, with exception of font-variant-position (has a specific purpose).

38
Q

Font-variant-ligatures (CSS3 font-variant value)

A

A ligature is a glyph that combines two or more characters into one symbol.

39
Q

Font-variant-caps (CSS3 font-variant value)

A

Allows the selection of small-cap glyphs (small-caps) from the font’s character set rather than simulating them in the browser. Other values: all-small-caps, unicase, tilting-caps, petite-caps and all-petite-caps. See book for more info.

40
Q

Font-variant-position (CSS3 font-variant value)

A

Selects superscript or subscript glyphs from the font’s character set when available. Or, browser creates the symbols by shrinking and moving the character above/below baseline.

41
Q

Font-variant-numeric (CSS3 font-variant value)

A

Allows the selection of various number character styles if they are available. Other values: proportional-numbers/tabular-numbers, old-style-nums, diagonal-fractions/stacked-fractions, ordinal, slashed-zero. See book for more info.

42
Q

Font-variant-alternates (CSS3 font-variant value)

A

Fonts sometimes offer more than one glyph for a particular character. Font-variant-alternates provides a way to specify swashes and other alternative characters. Many of its values are font-specific and must be defined first with the @font-features-values at-rule.

43
Q

Font-variant-east-asian (CSS3 font-variant value)

A

Allows selection of particular Asian glyphs.

44
Q

Font-size-adjust (other CSS3 properties)

A

The size text looks on the page often has more to do with the height of the lowercase x (its x-height) than the specified size of the text. Allows the browser to adjust the size of a fallback font until its x-height matches the x-height of the first-choice font. Can ensure better legibility even when a fallback font needs to be used.

45
Q

Font-kerning (other CSS3 properties)

A

Kerning is the space between character glyphs. Fonts typically contain
metadata about which letter pairs need to be cozied up together to make the spacing in a word look consistent. The font-kerning property allows the font’s kerning information to be applied (normal), turned off (none), or left to the browser’s discretion (auto).

46
Q

Font-feature-settings (other CSS3 properties)

A

This property gives authors the ability to control advanced typographic
features in OpenType fonts that are not widely used (swashes, small, caps, ligatures, automatic fractions, and more). Spec recommends you use font-variant whenever possible and reserve font-feature-settings for edge cases. As of this writing, however, the font-feature-settings property has better browser support, so for the time being it may be a better option. But cascades poorly.

47
Q

Font-language-override (other CSS3 properties)

A

This experimental property controls the use of language-specific glyphs.

48
Q

Text color

A

Use typical color property. Color is inherited. According to the CSS specification, it
is used to change the foreground color of an element. The foreground of an element consists of both the text it contains as well as its border.

49
Q

Border-color property

A

Changes the color of the border specifically.

50
Q

Descendant Selectors

A

Targets elements that are contained within (and therefore are descendants of) another element. It is a contextual selector because it selects the element based on its context or relation to another element. Descendant selectors are one of four types of contextual selectors. Indicated in a list separated by a character space. Ex. h1 em, h2 em, h3 em { color: red; } targets em when it appears under h1, h2, and h3.

51
Q

ID selector (general)

A

Id attribute: gives an element a unique identifying name (its id reference). Can be used with any element, and it is commonly used to give meaning to the generic div and span.

ID selectors allow you to target elements by their id values. The hash symbol indicates the id selector. Because id values must be unique in the document, it is acceptable to omit the element name. Can be li#sleestak { color: olive; } or #sleestak { color: olive; } because this li is the only one receiving this id.

52
Q

ID selector as a contextual selector

A

A style is applied only to elements that appear within the element identified as “resources.” In this way, you can treat links in the element named “resources” differently than all the other links on the page without any additional markup. Ex. #resources a { text-decoration: none; }

53
Q

Other contextual selectors: Child selector

A

Similar to a descendant selector, but it targets only the direct children of a given element. There may be no other hierarchical levels in between. They are indicated with greater-than symbol. Ex. p > em {font-weight: bold;}

54
Q

Other contextual selectors: Next-sibling selector

A

Targets an element that comes directly after another element with the same parent. It is indicated with a plus sign. h1 + p {font-style: italic;}

55
Q

Other contextual selectors: Subsequent-sibling selectors

A

Selects an element that shares a parent with the specified element and occurs after it in the source order. They do not need to follow one another directly. The following rule selects any h2 that both shares a parent element (such as a section or article) with an h1 and appears after it in the document. Ex. h1 ~ h2 {font-weight: normal;}

56
Q

Class Selectors

A

Targets elements belonging to the same class. Class names are indicated with a period at the beginning of the selector. To be more specific and select all paragraphs with class=”special”, use this selector (the period indicates the following word is a class selector): p.special { color: orange; }

57
Q

Specificity 101

A

Which refers to the fact that more specific selectors have more weight when it comes to handling style rule conflicts.

58
Q

Most specific to least specific: (4)

A
  1. Inline styles with the style attribute are more specific than (and will override…).
  2. ID selectors, which are more specific than (and will override…).
  3. Class selectors, which are more specific than (and will override…).
  4. Individual element selectors.
59
Q

Specific box method

A

To calculate specificity of a particular piece of content: Box 1 is number of IDs as selector, Box 2 is the number of class/pseudo-classes in the selector, and Box 3 is number of element names. The first box that is not a tie determines which selector wins. Any number in the first box is more specific than many numbers in boxes 2 and 3 of another.

60
Q

The Universal Selector (*)

A

Matches any element- like a wildcard in programming languages. It is also useful as a contextual selector. Be aware that every element will be selected with the universal selector, including some that you might not be expecting to style. The safest bet is to
avoid the universal selector.

61
Q

Line-height (properties)

A

Values: number | length measurement | percentage | normal
Default: normal
Applies to: all elements
Inherits: yes

62
Q

Line-height definition/basics

A

Defines the minimum distance from baseline to baseline in text. Instead of space being added between lines, the extra space is split above and below the text. The result is that line-height defines the height of a line-box in which the text line is vertically centered.

63
Q

Number values (line-height)

A

When a number is specified alone, it acts as a scaling factor that is multiplied by the current font size to calculate the line-height value.

64
Q

Number vs relative values (line-height)

A

The difference between using a scaling factor (number value) and a relative value (em or %) is how they inherit. If you set the line height with a scaling factor for a whole document on the body element, its descendants inherit the
multiplier. If you set the line-height on the body element using ems or percentages,
its descendants inherit the calculated size based on the body’s font size. This is likely not the effect you are after, making number values a more intuitive option.

65
Q

Text-indent (properties)

A

Values: length measurement | percentage
Default: 0
Applies to: block containers
Inherits: yes

66
Q

Text-indent definition/basics

A

Indents the first line of text by a specified amount. Indents just the first line of a block. Percentage values are calculated based on the width of the parent element, and are passed down to their descendant elements as percentage values (not calculated values).

Negative values are fine, they just cause the first line to hang out to the left of the left text edge (called a hanging indent).

67
Q

Horizontal-text alignment definition/basics

A

You can align text for web pages just as you would in a word processing or desktop publishing program with the text-align property.

68
Q

Horizontal-text alignment values (4)

A

text-align: left Aligns text on the left margin
text-align: right Aligns text on the right margin
text-align: center Centers the text in the text block
text-align: justify Aligns text on both right and left margins

69
Q

Horizontal-text alignment (properties)

A

Values: left | right | center | justify | start | end
Default: start
Applies to: block containers
Inherits: yes

70
Q

Text-decoration (properties)

A

Values: none | underline | overline | line-through | blink
Default: none
Applies to: all elements
Inherits: no, but since lines are drawn across child elements, they may look like they are “decorated” too.

71
Q

Text-decoration definition/basics

A

For putting lines under, over, or through text.

The most popular use of the text-decoration property is turning off the underlines that appear automatically under linked text (none).

72
Q

Text-decoration warnings

A
  1. First, if you get rid of the underlines under links, be sure there are other cues to compensate, such as color and weight.
  2. On the flip side, because underlines are such a strong visual cue to “click here,” underlining text that is not a link may be misleading and frustrating. Consider whether italics may be an acceptable alternative.
  3. Finally, there is no reason to make your text blink. Browser makers agree and therefore have dropped support for blinking text.
73
Q

Text-transform (properties)

A

Values: none | capitalize | lowercase | uppercase | full-width
Default: none
Applies to: all elements
Inherits: yes

74
Q

Text-transform definition/basics

A

Changes its capitalization when it renders without changing the way it is typed in the source.

75
Q

Text-transform values (5)

A

Values:
1. none As it is typed in the source.
2. capitalize Capitalizes the first letter of each word.
3. lowercase Makes all letters lowercase.
4. uppercase Makes all letters uppercase.
5. full-width Chooses a “full-width” version of a character if one exists (not well supported).

76
Q

Letter-spacing (all)

A

Used to insert space between letters (letter-spacing).
Values: length measurement | normal
Default: normal
Applies to: all elements
Inherits: yes

77
Q

Word-spacing (all)

A

Used to insert space between words (word-spacing).
Values: length measurement | normal
Default: normal
Applies to: all elements
Inherits: yes

78
Q

Note about em in spacing

A

When you specify em measurements, the calculated size is passed down to child elements, even if they have a smaller font size than the parent.

79
Q

Text-shadow (properties)

A

Values: ‘horizontal offset’ ‘vertical offset’ ‘blur radius’ ‘color’ | none
Default: none
Applies to: all elements
Inherits: yes

80
Q

Text-shadow definition/basics

A

Adds a “shadow” below your text that makes it seem to hover or pop out above the page. Has gone out of fashion, but still sometimes useful. The value for the text-shadow property is two or three measurements (a horizontal offset, vertical offset, and an optional blur radius) and a color.

81
Q

Values for text-shadow property (3)

A

Horizontal offset: Positions the shadow to the right of the text (a negative value pulls the shadow to the left of the text).

Vertical offset: Moves the shadow down by the specified amount (a negative value moves the shadow up).

Blur radius: 0 is no blur, and the blur gets softer with higher values.

82
Q

Multiple light sources in text-shadow

A

It is possible to apply several text shadows to the same element. If you vary the position and blur amounts, you can give the text the appearance of multiple light sources.

83
Q

Warnings for text shadow

A
  1. Can make text difficult to read.
  2. Can slow down page performance (scrolling, mouse interactions,
    etc.).
  3. Be careful that your text doesn’t require a shadow in order to be visible. Folks with non-supporting browsers won’t see a thing. Use drop shadows as an enhancement.
84
Q

List-style-type (properties)

A

Values: none | disc | circle | square | decimal | decimal-leading-zero | lower-alpha | upper-alpha | lower-latin | upper-latin | lower-roman |upper-roman | lower-greek

Default: disc
Applies to: ul, ol, and li (or elements whose display value is list-item)
Inherits: yes

85
Q

List-style-type definition/basics

A

Apply the property to the ul, ol, or li element select the type of marker that appears before each list item. Commonly, people use list-style-type property with its value set to none to remove bullets or numbers altogether.

86
Q

Bullets and default rendering

A

Unfortunately, there is no way to change the appearance (size, color, etc.) of generated bullets, so you’re stuck with the browser’s default rendering.

87
Q

List-style-type-position (properties)

A

Values: inside | outside | hanging
Default: outside
Applies to: ul, ol, and li (or elements whose display value is list-item)
Inherits: yes

88
Q

List-style-type-position definition/basics

A

By default, the marker hangs outside the content area for the list item, displaying as a hanging indent. This property allows you to pull the bullet inside the content area so it runs into the list content.

89
Q

Hanging value (list-style-position)

A

It is similar to inside, but the markers appear outside and abutting the left edge of the shaded area.

90
Q

List-style-image (properties)

A

Values: url(location) | none
Default: none
Applies to: ul, ol, and li (or elements whose display value is list-item)
Inherits: yes

91
Q

List-style-image definition/basics

A

Use to create your own bullets. Use a list-style-type option as a backup in addition in case not supported.

92
Q

List-style shorthand (all)

A

Combines the values for type, position, and image, in any order. For example: ul {list-style: url(/images/rainbow.gif) disc outside;}