Advanced CSS Flashcards

1
Q

vendor prefixes for major browsers:

A
  • moz- : Firefox
  • webkit- : Webkit browsers such as Safari and Chrome
  • o- : Opera
  • ms- : Internet Explorer
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Give an example of vendor prefixes in action:

A
  • webkit-transition: all 4s ease;
  • moz-transition: all 4s ease;
  • ms-transition: all 4s ease;
  • o-transition: all 4s ease;
    transition: all 4s ease;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Even though, in our example, the “transition” property is consistent across all browsers, some browsers have a different syntax for certain properties. Have look at this CSS gradient implementation:

A

Creating Cross-Browser Linear Gradients with CSS3

-webkit-linear-gradient(left, #999999 0%, #ffffff 100%);

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

Apart from px, pt, %, em, developers have access to:

A

rem (root em)
vw (viewport width)
vh (viewport height)

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

____ values are relative to the root html element, for instance, if the font-size of the root element is 16px then 1 rem = 16px for all elements.

A

rem (root em). rem values are relative to the root html element, for instance, if the font-size of the root element is 16px then 1 rem = 16px for all elements.

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

____ whereas the % values are relative tio the containing parent, vw is relative to the sise of the viewport. 1 vw = 1/100th of the viewport’s width.

A

vw (viewoport width). Whereas the % values are relative tio the containing parent, vw is relative to the sise of the viewport. 1 vw = 1/100th of the viewport’s width.

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

_______ Same as vw, except vh is used for height.

A

vh (viewport height). Same as vw, except vh is used for height.

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

Commonly used advanced selectors include:

A

Select:

  • multiple elements
  • descendant elements
  • child elements
  • siblings
  • adjacent sibling
  • by attribute or attribute value
  • attribute begins or ends with value
  • select NOT elements
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
  • multiple elements
A

div,p{
color:red;
}

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

div p{
color:red;
}

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

div>p{
color:red;
}

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

h2 ~ p{
color:red;
}

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

h2 + p{
color:red;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q
  • by attribute or attribute value
A

input[autofocus]{
border:1px solid red;
}

input[type=text]{
	border:1px solid red;
	padding:10px;
	background-color:#CCCCCC;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
  • attribute begins or ends with value
A

a[href^=”https://”]{
color:red;
}

a[href$=”.pdf”]{
color:red;
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
  • select NOT elements
A

:not(p){
font-weight:bold;
}

17
Q

As mentioned, for a transition to take place, an element must have a change in state, and different styles must be identified for each state.

The easiest way for determining styles for different states is by using the :____, :_____, :____, and :____ pseudo-classes.

A

As mentioned, for a transition to take place, an element must have a change in state, and different styles must be identified for each state.

The easiest way for determining styles for different states is by using the :hover, :focus, :active, and :target pseudo-classes.

18
Q

The actual syntax for the transform property is quite simple, including the transform property followed by the value. The value specifies the transform type followed by a specific amount inside parentheses.

A
div {
  -webkit-transform: scale(1.5);
     -moz-transform: scale(1.5);
       -o-transform: scale(1.5);
          transform: scale(1.5);
}
19
Q

2D Rotate (transform property)

A

.box-1 {
transform: rotate(20deg);
}

20
Q

2D Scale (transform property)

A

.box-1 {
transform: scale(.75);
}

21
Q

2D Translate (transform property)

A

.box-1 {
transform: translateX(-10px);
}

22
Q

2D Skew (transform property)

A

.box-1 {
transform: skewX(5deg);
}

23
Q

Combining Transforms

A

.box-1 {
transform: rotate(25deg) scale(.75);
}

24
Q

2D Cube Demo

A
.cube {
  position: relative;
}
.side {
  height: 95px;
  position: absolute;
  width: 95px;
}
.top {
  background: #9acc53;
  transform: rotate(-45deg) skew(15deg, 15deg);
}
.left {
  background: #8ec63f;
  transform: rotate(15deg) skew(15deg, 15deg) translate(-50%, 100%);
}
.right {
  background: #80b239;
  transform: rotate(-15deg) skew(-15deg, -15deg) translate(50%, 100%);
}