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
capitalize all paragraphs
p { text-transform: capitalize; }
26
change h1 to uppercase
h1 { text-transform: uppercase; }
27
change vertical spacing between rows of text
body { line-height: 1.5; }
28
specify that a
's padding and borders are included in the total width and height of the element
div { box-sizing: border-box; }
29
repeat a background-image horizontally inside .main-header
.main-header { background-repeat: repeat-x; }
30
make a background image 40% of the .main-header
.main-header { background-size: 40%; }
31
change the position of the background image inside the .main-header to center bottom;
.main-header { background-position: center bottom; }
32
move the background image 20% to the left and 40% down inside the .main-header
.main-header { background-position: 20% 40%; }
33
float two columns (primary col, secondary col)
.col { width: 46.5%; } .primary { float: left; } secondary { float: right; }
34
clearfix .group (parent element)
``` .group::after { content: ""; display: table; clear: both; } ```
35
remove list indentation inside a ul
ul { padding-left: 0; }
36
move bullet points inside the li element
ul { list-style-position: inside; }
37
change bullet points to squares
ul { list-style-type: square; }
38
add 10px vertical space between li items
ul { margin: 10px; }
39
apply a text shadow to h1 (blur radius 12px, color green, 10px horizontal and 15px vertical offset)
h1 { text-shadow: 10px 15px 12px green; }
40
move the text shadow to the left inside h1
h1 { text-shadow: -10px -15px 12px green; }
41
create an inner shadow effect inside .wildlife
.wildlife { box-shadow: inset 0 0 50px 10px rgba (0, 0, 0, 1); }
42
create a smooth fade from red to orange inside the .main-header
.main-header { | background-image: linear gradient(red, orange);
43
use transparent gradient with multiple backgrounds
.main-header { background: linear-gradient (#ffa949, transparent 90%), linear-gradient(0deg, #fff, transparent), url(‘../img/mountains.jpg’) no-repeat center; }
44
create two columns using inline-block
.col { display: inline-block; width: 50%; margin-right: -4px; vertical-alignment: top; padding-left: 1em; padding-right: 1em; }
45
meta tag for responsive design
46
breakpoint for tablets
@media (min-width: 765px) { }
47
breakpoint for desktops
@media (min-width: 1025px) { }
48
max-width for desktops
.wrapper { max-width: 1150px; }
49
how do you fix collapsing margins of .main-header and ?
.main-header { padding: 1em 0; margin: 0; }
50
create a sticky footer
1. Create .wrap (below body and before footer ) 2. .wrap { min-height: calc(100vh-82px); }
51
get rid of the space between
  • items
  • .main-nav li { margin-right: -4px; }
    52
    Add a fixed navigation screen (for desktops)
    ``` .main-header { position: fixed; width: 100%; top: 0; } ``` body { padding-top: 15px; (compensates for the space covered by the bar) }
    53
    make .profile-img 1.5 times larger on hover
    .profile-img:hover { transform: scale(1.5); }
    54
    target all input fields of text type
    input[type="text"] { }
    55
    change .btn cursor from arrow to pointer
    .btn { cursor: pointer; }
    56
    target all links that are direct children of form
    form > a { color: pink; }
    57
    target adjacent .btn, which is an immediate sibling of .btn
    .btn + .btn { margin-left: 20px; }
    58
    target all label siblings of h1
    h1 ~ label { }
    59
    target the first child of li
    li::first-child { }
    60
    target the only child (with no siblings) of span
    span::only-child { }
    61
    target all empty li fields
    li::empty { }
    62
    target all links that start with http://
    a[href^="http://] { }
    63
    target all links that are pdf-files
    a[href$=".pdf"] { }
    64
    target all links that contain the word download in their filename
    a[href*="download"] { }
    65
    create a flex .container
    .container { display: flex; }
    66
    change the background color of an input field and a text area when they get focus to yellow
    input:focus, textarea:focus { background-color: yellow; }
    67
    change the color of the disabled input field to light grey
    input:disabled { background: #ddd; }
    68
    make the checkbox and the label bold when checked
    input[type="checkbox"]:checked + label { font-weight: bold; }
    69
    target all odd li items and make the background aqua green
    li:nth-child(odd) { background: #52bab3; }
    70
    target every 2nd li item starting at the 3rd one and change the background color to aqua green
    li:nth-child(2n+3) { background: #52bab3; }
    71
    select the first three li items
    li:nth-child(-n+3) { background: #52bab3; }