CSS Flashcards

basic and responsive css rules

1
Q

What are the tenets of performance driven selectors

A

Keep selectors short – minimize specificity, allows for inheritance and portability

Favour classes – reuse styles. Key selectors should be specific

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

Tenets of reusing code

A

DRY – don’t repeat yourself, reuse code and group together selectors that use the same styling, separated by a comma

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

What is the DOM

A

Document Object Model. An API for HTML which provides structural representation.

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

Position: static

A

Elements have this by default.

Don’t have nor will accept any specific box offset properties.

Will be positioned as intended with default behaviours

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

Position: relative;

A

Similar to static. But will accept box offset properties of top, right, bottom and left.

Allows elemtent to be precisely positioned, shifting it from it’s default position.

Other elements will not impede on where relatively positioned elements are placed.

These elements may overlap or underlap other elements without moving them from their position

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

Position: absolute;

A

Removed from normal flow of the document

Accepts offset properties

Positioned relative to their containing parent or the body of the document

Not setting offsets will position it top left of its closest relatively positioned parent

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

Position: fixed;

A

Positioned relative to browser viewport

Does not scroll with the page;

Used with headers and footers, with left and right offsets declared.

Will produce same beahviours as an absolutely positioned element;

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

What does z-index do

A

Position stacked elements along the z axis

Position value must first be applied (relative, absolute, fixed), you can’t stack elements that don’t have a position element declared.

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

section p

A

Common child selector – selects every element that is contained anywhere within the parent, even if it is contained within another element within that parent e.g. section article p

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

section > p

A

Direct child selector – selects only elements that are direct descendants of an element. E.g. section article p will not be selected

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

h2 ~ p

A

General sibling selector – selects all elements that are siblings to the first element

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

h2 + p

A

Adjacent sibling selector – selects only the element that is adjacent to the first selector

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

a[target]

A

Attribute present selector – selects elements based on whether it includes the attribute or not

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

a[href=”google.com”]

A

Attribute equals selector - selects element with specific and exact matching attribute value

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

a[href*=”login”]

A

Attribute contains selector - selects element with part of the attribute value, not exact match

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

a[href^=”https://”]

A

Attrbute begins with selector – selects element based on what attribute value starts with

17
Q

a[href$=”.pdf”]

A

Attribute ends with selector, as starts with but value ends with query

18
Q

a[rel~=”tag”]

A

Attribute spaced selector – selects elements where more or one value exists separated by a space, and only one attribute needs to be matched

19
Q

a[lang|=”en”]

A

Attribute hyphenated selector – as spaced selector but values are separated by a hyphen