Styling Flashcards

1
Q

Set font color to red

A

color: red;

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

Set font to “Gill Sans”

A

font-family: "Gill Sans", sans-serif;

Always provide web-safe web as a backup

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

Set font to bold

A

font-weight: bold

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

Set font size to 17px

A

font-size: 17px

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

Add solid red underline to text in p

A

text-decoration: underline solid red

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

Capitalize text in p

A

text-transform: capitalize

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

Center the text in p

A

text-align: center

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

Increase line height by 50%

A

line-height: 1.5

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

Break words in p when necessary

A

word-break: normal;

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

What are web safe fonts

A

Web safe fonts: certain number of fonts that are generally available across all systems and can therefore be used without much worry.

Example: serif, sans-serif, monospace

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

How to set text shadow, what are the arguments

A

Arguments:
- Horizontal offset: positive values move the shadow right, and negative values left.
- Vertical offset: positive - up, negative - down.
- The blur radius (optional): a higher value means the shadow is dispersed more widely.
- Color (optional)

text-shadow: 4px 4px 5px red;

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

Change list marker (like ul) to circle

A

list-style-type: circle;

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

Change list marker (like ul) to 🥕 (unicode char) or set it’s color to red

A
\::marker {
  color: red;
  content: "🥕";
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Change link color depending on it’s state. List all the stated and how to targe them.

A
  • Link: A link that has a destination (i.e., not just a named anchor). :link pseudo class.
    • Visited: :visited pseudo class.
    • Hover: :hover pseudo class.
    • Focus: A link that is focused (e.g., moved to by a keyboard user using the Tab key or something similar, or programmatically focused using HTMLElement.focus()) — :focus pseudo class.
    • Active: A link that is activated (e.g., clicked on but not released yet), :active pseudo class.

ORDER IS IMPORTANT! (LoVe Fears HAte.)

a:link {
  color: #6900ff;
}

a:visited {
  color: #a5c300;
}

a:focus {
  color: #a5c300;
}

a:hover {
  color: #a5c300;
}

a:active {
  color: #a5c300;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Different strategies for fitting images inside a box, how to set them.

A
  • cover sizes the image down, maintaining the aspect ratio so that it neatly fills the box. As the aspect ratio is maintained, some parts of the image will be cropped by the box.
    • contain scales the image down until it is small enough to fit inside the box. This results in “letterboxing” as it is not the same aspect ratio as the box.
    • fill will fill the box but not maintain the aspect ratio.

object-fit: cover;

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

Table: size your columns according to the width of their headings (not how much content they contain)

A

```table {
table-layout: fixed;
}
~~~

17
Q

Table: Prevent double border around cells

A

```table {
border-collapse: collapse;
}
~~~

18
Q

Table: Implement zebra striping

A
tbody tr:nth-child(odd) {
  background-color: #ff33cc;
}

tbody tr:nth-child(even) {
  background-color: #e495e4;
}