CSS Flashcards

1
Q

How do you create a new font to use in a website?

A

@font-face {
font-family: emulogic;
src: url(“../fonts/umulogic.ttf”);
}

NOTE: If using firefox, the font has to be in the same folder as the css.

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

Having created a new font called emulogic, how would I apply it to all elements on the page?

A
  • {
    font-family: emulogic;
    }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the order of applying stylesheets?

A

External, internal, then inline style elements

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

What are the two types of element that are often used to apply CSS to content of a webpage?

A

span and div

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

What CSS attribute would you use to make text indent a little?

A

p {
text-indent: 2em;
}

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

What is the difference between p.first and p .first?

A

p.first means choose a paragraph that has the class first.

p .first means choose an element within a paragraph that has the class first.

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

What does ex and em measure?

A

ex typically measures the height of an item in a web browser (ex is height of lower case x)

em typically measures the width of an item (em is the width of an uppercase M).

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

Suppose a 1px black box is placed around text, padding adds space where?

A

Inside the content box

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

Suppose a 1px black blox is placed around text, margin adds space where?

A

Around the outside of the content box

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

What are the four kinds of positioning in CSS?

A

Absolute, relative, float and fixed

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

Why would you set the containing div as a relative?

A

Because it needs to be a positioned block to qualify as a container - this must be either Relative or Absolute

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

Why do you not have to specify the top / left position in an outer containing block if you have set it to relative?

A

By setting it to relative, it behaves like a “static” block, but positioned. So it will automatically take the 0, 0 position on the page - then just specify width / height

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

Absolute on an object means the positions are relative too…

A

the boundaries of the containing object.

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

What attribute can I specify to set the order of rendering on a page?

A

z-index: 10;

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

Is relative positioning good for laying out blocks of text?

A

Not really - absolute positioning is probably better.

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

What does relative positioning actually do?

A

It moves the object relative to where it should be in the document… however, everything else renders as if it is in the original, correct position.

17
Q

What is the most common use of relative positioning?

A

To set the position of an outer containing block (so it qualifies as a reference point).

18
Q

If there is an object that is floating to the left, how do you make sure text that follows it doesn’t wrap?

A

clear: left;

19
Q

Do fixed elements fit within the flow of a document?

A

No, they are taken out of the flow and do not affect the layout of the page.

They also do not affect / create scroll bars

20
Q

What is a common use of the fixed positioning attribute?

A

Menus

21
Q

margin: 25px 50px 75px; sets which sides?

A

top is 25px
right and left is 50px
bottom is 75px

22
Q

margin: 25px 50px; sets which sides?

A

Top and bottom margins 25px

Right and left margins are 50px;

23
Q

margin: 25px sets which sides?

A

All four margins are 25px;

24
Q

Which direction do margin settings follow?

A

Clockwise (top, right, bottom, left)

25
Q

Do floated elements add to the height of a container element?

A

No

26
Q

If a floating element doesn’t add to the height of a container, how might you fix it?

A

You need to clear the floats. One way is to add an empty paragraph at the end, and use CSS to remove floats:

XHTML:
< p class=”clear” />
CSS
.clear { clear: both; }

27
Q

What issue does I.E. have with styling unordered lists, and how do you fix it?

A

The list will be hard against (even over) the left margin. You need to set the last (left side) field of the margin to 1em to make it closer to consistent between browsers.

margin: 0 0 1.4ex 1em;

28
Q

How do you link in a stylesheet?

A

< link rel=”stylesheet” type=”text/css” href=”css/main.css” />