CSS Flashcards

1
Q

Remove underline from links

A

text-decoration: none;

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

style selected link and hover

A

nav a.selected, nav a:hover {
color: #32673f;
}

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

Google fonts

A

google.com/fonts

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

remove bullet points from lists

A

list-style: none;

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

clear floats in the footer

A

footer {
clear: both;
}

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

display navigation links as an inline block

A

nav li {
display: inline-block;
}

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

add a phone link

A

<a> 567 - 3455</a>

</a>

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

add a background img next to the phone link

A

.contact-info li.phone a {
background-image: url(‘../img/phone.png’);
}

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

change background-repeat to none

A

background-repeat: no-repeat;

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

shorthand for commenting something out

A

CMD + SHIFT + /

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

clear left float from every 4th img

A
#gallery li:nth-child(4n) {
        clear: left;
    }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

import an external CSS file

A

@import “import-styles.css“; (at the beginning of the css file)

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

how to convert px to em

A

divide width in px by 16

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

style links on hover with rgba color property

A

a: hover {
color: rgba (255, 169, 73, .4)

}

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

change text to uppercase

A

text-transform: uppercase;
lowercase
capitalise;

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

underline h2

A

h2 {
text-decoration: underline;
}

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

change vertical spacing between lines of text

A

body {
line-height: 1.5;
}

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

add a solid blue border 10px wide

A

border: 10px solid blue;

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

center a div

A

margin: 0 auto;

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

universal selector

A

{ * }

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

selector for a visited link

A

a:visited

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

white color

A

fff

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

black color

A

000

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

change color with rgba

40% transparency

A

color: rgba (255, 170, 65, .4);

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

capitalize all paragraphs

A

p {
text-transform: capitalize;
}

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

change h1 to uppercase

A

h1 {
text-transform: uppercase;
}

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

change vertical spacing between rows of text

A

body {
line-height: 1.5;
}

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

specify that a <div>’s padding and borders are included in the total width and height of the element</div>

A

div {
box-sizing: border-box;
}

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

repeat a background-image horizontally inside .main-header

A

.main-header {
background-repeat: repeat-x;
}

30
Q

make a background image 40% of the .main-header

A

.main-header {
background-size: 40%;
}

31
Q

change the position of the background image inside the .main-header to center bottom;

A

.main-header {
background-position: center bottom;
}

32
Q

move the background image 20% to the left and 40% down inside the .main-header

A

.main-header {
background-position: 20% 40%;
}

33
Q

float two columns (primary col, secondary col)

A

.col {
width: 46.5%;
}

.primary {
float: left;
}

secondary {
float: right;
}

34
Q

clearfix .group (parent element)

A
.group::after {
content: "";
display: table;
clear: both;
}
35
Q

remove list indentation inside a ul

A

ul {
padding-left: 0;
}

36
Q

move bullet points inside the li element

A

ul {
list-style-position: inside;
}

37
Q

change bullet points to squares

A

ul {
list-style-type: square;
}

38
Q

add 10px vertical space between li items

A

ul {
margin: 10px;
}

39
Q

apply a text shadow to h1 (blur radius 12px, color green, 10px horizontal and 15px vertical offset)

A

h1 {
text-shadow: 10px 15px 12px green;
}

40
Q

move the text shadow to the left inside h1

A

h1 {
text-shadow: -10px -15px 12px green;
}

41
Q

create an inner shadow effect inside .wildlife

A

.wildlife {
box-shadow: inset 0 0 50px 10px rgba (0, 0, 0, 1);
}

42
Q

create a smooth fade from red to orange inside the .main-header

A

.main-header {

background-image: linear gradient(red, orange);

43
Q

use transparent gradient with multiple backgrounds

A

.main-header {
background: linear-gradient (#ffa949, transparent 90%),
linear-gradient(0deg, #fff, transparent), url(‘../img/mountains.jpg’) no-repeat center;
}

44
Q

create two columns using inline-block

A

.col {

display: inline-block;
width: 50%;
margin-right: -4px;
vertical-alignment: top;
padding-left: 1em;
padding-right: 1em; }
45
Q

meta tag for responsive design

A
46
Q

breakpoint for tablets

A

@media (min-width: 765px) { }

47
Q

breakpoint for desktops

A

@media (min-width: 1025px) { }

48
Q

max-width for desktops

A

.wrapper {
max-width: 1150px;
}

49
Q

how do you fix collapsing margins of .main-header and ?

A

.main-header {
padding: 1em 0;
margin: 0;
}

50
Q

create a sticky footer

A
  1. Create .wrap (below body and before footer )
  2. .wrap {
    min-height: calc(100vh-82px);
    }
51
Q

get rid of the space between <li> items</li>

A

.main-nav li {
margin-right: -4px;
}

52
Q

Add a fixed navigation screen (for desktops)

A
.main-header {
	position: fixed;
	width: 100%;
	top: 0;
}

body {

padding-top: 15px;  (compensates for the space covered by the bar)

}

53
Q

make .profile-img 1.5 times larger on hover

A

.profile-img:hover {
transform: scale(1.5);
}

54
Q

target all input fields of text type

A

input[type=”text”] {

}

55
Q

change .btn cursor from arrow to pointer

A

.btn {
cursor: pointer;
}

56
Q

target all links that are direct children of form

A

form > a {
color: pink;
}

57
Q

target adjacent .btn, which is an immediate sibling of .btn

A

.btn + .btn {
margin-left: 20px;
}

58
Q

target all label siblings of h1

A

h1 ~ label { }

59
Q

target the first child of li

A

li::first-child { }

60
Q

target the only child (with no siblings) of span

A

span::only-child { }

61
Q

target all empty li fields

A

li::empty { }

62
Q

target all links that start with http://

A

a[href^=”http://] { }

63
Q

target all links that are pdf-files

A

a[href$=”.pdf”] { }

64
Q

target all links that contain the word download in their filename

A

a[href*=”download”] { }

65
Q

create a flex .container

A

.container {
display: flex;
}

66
Q

change the background color of an input field and a text area when they get focus to yellow

A

input:focus,
textarea:focus {
background-color: yellow;
}

67
Q

change the color of the disabled input field to light grey

A

input:disabled {
background: #ddd;
}

68
Q

make the checkbox and the label bold when checked

A

input[type=”checkbox”]:checked + label {
font-weight: bold;
}

69
Q

target all odd li items and make the background aqua green

A

li:nth-child(odd) {
background: #52bab3;
}

70
Q

target every 2nd li item starting at the 3rd one and change the background color to aqua green

A

li:nth-child(2n+3) {
background: #52bab3;
}

71
Q

select the first three li items

A

li:nth-child(-n+3) {
background: #52bab3;
}