CSS Flashcards

1
Q

CSS makes a website ___

A

Pretty (the designer of the website)

Colors, font, spacing

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

CSS stands for ___

A

Cascading Style Sheet

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

100% when using CSS you need to have this tag

A

selector (element you want to change {property (color, etc.): value (what you want to change it to);}

IT MUST ALWAYS BE IN THE HEAD

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

Give an example of using color for h1 using css

A

h1 { color: red; font-family: arial;}

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

How to get more spacing in paragraph lines?

A

p {line-height: ;}

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

what does:
background-image:url(file.type);
background-repeat: no-repeat;

A

Background image and no repeat for text/css (mostly used for the body)

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

Four characteristics of elements (box model):

A

text, padding, margin, border

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

How many styles can a link have?

A

4 link styles for the different states. the states are:

1) Link
2) visited
3) hover
4) active

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

How do you make a css rule just affect one part of an element?

A

<span> text </span>

In the head, you give span it’s style properties

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

How do you create unique styles for elements? How to give different styles to div?

A

using CSS, use ID’s

In header, use #IDNAME to create an ID

Then go to element, and add id = “IDNAME”;

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

What does this represent in CSS: p > a?

A

paragraph is the parent and a is the child

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

How do you apply style to only a specific part of an element?

A

You’ll have to use pseudo elements

p: first-letter {}

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

How do you link to an external style sheet?

A

Note: Useful for multiple pages. GET RID OF STYLE TAGS WHEN USING. Remember the saved file you are referencing should be a .css file.

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

What is the difference between absolute vs relative positioning?

A

Absolute is from the top left and relative is from the original position relative

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

How to create a basic form>

A

Name:

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

What are the three ways of attaching CSS to a document?

A

Inline, Internal, External. Inline and internal CSS are considered to be bad practices.

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

What is a stylesheet?

A

List of rules. Each rule or ruleset consists of one or more selectors and a declaration block

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

What is the purpose of a CSS selector?

A

Selectors are used for declaring the HTML elements to which a style will apply

19
Q

What are the most common selectors?

A

1) All elements with a specific HTML tag (e.g., p,h1)
2) Elements specified by the following attributes:
ID (these are preceded by # in CSS)
class (these are preceded by . in CSS)

20
Q

What is a declaration block and what does it contain?

A

A declaration block is a list of declarations contained within braces. Each individual declaration consists of a property, a colon :, and a value.

Note: If there are multiple declarations then they must be separated by a semi-colon

21
Q

What is the internal priority for CSS?

A
element (1 pt)
.class (10 pt)
#id (100 pt)
22
Q

Width and height styling elements can be expressed in ?

A

Pixels and percentage. If you are working with static content, then px is suitable, but if you are working with responsive design, you will want to use %

23
Q

What is the purpose of styling element overflow?

A

Content inside of a container is too much for the container size. You can, hide, show no matter what, or scroll bar

24
Q

What are some of the background properties that can be modified?

A

background-color, background-image, background-position, background-size, background-repeat

25
Q

What does the border property do?

A

Property adjusts all border elements in one line. The first value is border thickness. Second value is border type. Third value is border color.

border-width, border-style, and border-color
border-top, border-bottom, border-right, border-left

border-radius also makes a change to the roundness of your border and can use px or %

26
Q

What do the following properties do: color, text-align, text-decoration?

A

Color is the color property, align sets the horizontal alignment of any text, text decoration is used to add and remove underlines, overlines, and line-throughs

27
Q

What are the two types of fonts in font-family?

A

named-family (such as times, courier) and generic-family (serif, sans-serif, cursive, fantasy, monospace)

28
Q

What are some web safe fonts? What is a web safe font?

A

Regardless of system, fonts are able to be used. Some of these are: Verdana, Arial, Trebuchet MS, Times New Roman, Georgia, Andale mono, Courier New, Comics Sans, and Impact

NOTE THAT FONTS WITH MORE THAN ONE WORD NEED SURROUNDING QUOTES

29
Q

If a font-style has no italic, what can be used to mimic?

A

Oblique to control the slanted emphasis

30
Q

What does font-weight do?

A

This property controls the thickness of a character line. can be set numerically or semantically like ‘bold’

31
Q

What is the difference between inline elements and block elements?

A

Inline items only take as much space as needed. Block items take up the 100% of the width of the parent element.

32
Q

What are examples inline elements? What are examples block elements?

A

Inline elements: a, img, span, input, label, select, textarea

Block elements: body, div, form, h1-h6, p, table, ul, ol, li

NOTE: You cannot put block elements inside inline elements

33
Q

What are the possible display property values?

A

inline, block, none, inline-block

34
Q

What are the three rules for content fitting?

A

Total area: the space an element occupies and affects
Float, clear and overflow
Nested elements

35
Q

shorthand for content fitting?

A

padding: top right bottom left

36
Q

What are the elements that do not have their margins collapsed?

A

Floated elements, absolutely positioned elements, inline-block elements, elements with overflow property set to anything other than visible (They do not collapse margins with their children), cleared elements (They do not collapse their top margins with their parent block’s bottom margins)

37
Q

The position property can also be used to move elements on a page.

A

USE THE POSITION PROPERTY ONLY WHEN YOU NEED TO. Otherwise, use the display property and the box model to position your elements.

38
Q

What are the main four position specifications?

A

Static, Relative, Absolute, Fixed

39
Q

Explain the four major positions

A

Static - Default, will follow flow of DOM
Relative - Relative to where the element should have been initially
Absolute - Position from last item that is not static
Fixed - Position relative to window

Relative is the only one that maintains flow

40
Q

Describe more about the absolute position

A

An absolutely positioned element is positioned relative to the first parent element that has a position other than static applied to it. If no parent element up the chain meets that condition the absolutely positioned element is positioned relative to the document window.

41
Q

How do you solve many cross-browser issues?

A

you should RESET and NORMALIZE…also validating your html/css often

42
Q

What is a good example of a reset?

A

*{ padding:0; margin:0;}

43
Q

Condensed Universal Reset?

A
* {
	vertical-align: baseline;
	font-weight: inherit;
	font-family: inherit;
	font-style: inherit;
	font-size: 100%;
	border: 0 none;
	outline: 0;
	padding: 0;
	margin: 0;
	}