CSS Syntax Flashcards

(25 cards)

1
Q

Comments in CSS

A

/* comment goes here */

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

Display properties

A

none, inline, block, inline-block, flex, grid

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

properties to align text

A

left, center, right

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

width property values

A

auto, %, em, vh, …. others?

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

CSS class selector

A

.class { }

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

CSS id selector

A

id { } (only 1 per html page)

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

Select all elements with both class c1 and c2 in the class attribute

A

.c1.c2 { }

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

Select all elements with element ‘c2’ that is a descendant of ‘c1’

A

.c1 .c2 { }

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

Select ALL elements

A

*

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

Select ALL elements ‘e’ with class ‘c’

A

e.c

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

Select ALL elements ‘e1’ and elements ‘e2’

A

e1, e2

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

Select ALL elements ‘e2’ WITHIN ‘e1’ elements

A

e1 e2

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

Select every ‘e2’ PRECEDED by an ‘e1’

A

e1 ~ e2

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

Set font size

A

font-size: xx-small, x-small, small, medium, large, larger, x-large, xx-large or a %, em, px, etc.

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

Set the background color for an element

A

body { background: yellow; }

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

General padding attribute

A

padding: top, right, bottom, left

17
Q

Options for ‘position’ property

A

static (default)

relative, fixed, absolute, sticky

18
Q

Meaning of the ‘static’ position property

A

Static positioned elements are not affected by the top, bottom, left, and right properties.

An element with position: static; is not positioned in any special way; it is always positioned according to the normal flow of the page:

19
Q

Meaning of the ‘relative’ position property

A

An element with position: relative; is positioned relative to its normal position.

Setting the top, right, bottom, and left properties of a relatively-positioned element will cause it to be adjusted away from its normal position. Other content will not be adjusted to fit into any gap left by the element.

20
Q

Meaning of the ‘fixed’ position property

A

An element with position: fixed; is positioned relative to the viewport, which means it always stays in the same place even if the page is scrolled. The top, right, bottom, and left properties are used to position the element.

A fixed element does not leave a gap in the page where it would normally have been located.

21
Q

Meaning of the ‘absolute’ position property

A

An element with position: absolute; is positioned relative to the nearest positioned ancestor (instead of positioned relative to the viewport, like fixed).

However; if an absolute positioned element has no positioned ancestors, it uses the document body, and moves along with page scrolling.

Note: A “positioned” element is one whose position is anything except static.

22
Q

Meaning of the ‘sticky’ position property

A

An element with position: sticky; is positioned based on the user’s scroll position.

A sticky element toggles between relative and fixed, depending on the scroll position. It is positioned relative until a given offset position is met in the viewport - then it “sticks” in place (like position:fixed).

23
Q

Syntax of a media query

A

@media only screen and (max-width=395px) { }

24
Q

Ways to insert CSS into HTML documents

A
  1. Internal CSS : The internal style is defined inside the element, inside the head section.
  2. Inline CSS: within the ‘style’ attribute of the element
  3. External CSS: <link></link>
25
Syntax of the 'border-style' property
border: style; (where style is: dotted - Defines a dotted border dashed - Defines a dashed border solid - Defines a solid border double - Defines a double border groove - Defines a 3D grooved border. The effect depends on the border-color value ridge - Defines a 3D ridged border. The effect depends on the border-color value inset - Defines a 3D inset border. The effect depends on the border-color value outset - Defines a 3D outset border. The effect depends on the border-color value none - Defines no border hidden - Defines a hidden border ) The border-style property can have from one to four values (for the top border, right border, bottom border, and the left border).