4. CSS Flashcards

1
Q

What does CSS do?

A

Allows applying the same format to various elements in a web page.

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

What are 3 types of CSS?

A
  1. External
  2. Internal
  3. Inline CSS
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

CSS structure?

A

Selector {property:value; property:value; …property:value}

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

How to make paragraph text black and 10 pixels large?

A

P {color:black; font-size:10px;}

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

What does a selector do?

A

A selector allows choosing the specific element of interest that needs styling.

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

Types of selectors? (3)

A
  1. Element selector
  2. Id selector
  3. Class selector
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is an element selector?

A

Selecting based on element name

ex:

p {
text-align: center;
color: red;
}→css applies to all <p></p> tags

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

What is a Id selector?

A

para1 {

Selecting based on the id of the element

ex:

text-align: center;
color: red;
}→ css applies to the HTML element with id=“para1” attribute

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

What is a class selector?

A

Selecting based on the class of the element

ex:

.center {
text-align: center;
color: red;
}→ css applies to the HTML elements with class=“center” attribute

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

What are styles used in this course? (7)

A
  1. Font
  2. Background
  3. Border
  4. Margin
  5. Padding
  6. Height
  7. Width
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does CSS mean?

A

Cascading Style Sheets

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

What is id? (2)

A
  1. A unique identifier, therefore, each specific id can only be assigned to one element in an HMTL page
  2. Used to target a single element
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is class used for? (2)

A
  1. Class is used for grouping elements together.
  2. Several elements can have the same class name
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Where are class and id defined?

A

Inside a tag (e.g., <p class=“class1” id=“para2”>…</p>)

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

CSS commment structure

A

/* This is a single-line comment */

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

HTML comment structure?

A

<!-- These paragraphs will be red -->

17
Q

3 useful properties to define colours

A
  1. background-color
  2. color (text color)
  3. border (you can assign more than one value to each property: <h1 style="border:2px solid Tomato;">Hello World</h1>)
18
Q

Basic Styles-Background properties (2)?

A
  1. background-color
  2. background-image

ex background-image:
body {background-image: url(“paper.gif”);}

19
Q

Border styles proporties? (10)

A
  1. dotted - Defines a dotted border
  2. dashed - Defines a dashed border
  3. solid - Defines a solid border
  4. double - Defines a double border
  5. groove - Defines a 3D grooved border. The effect depends on the border-color value
  6. ridge - Defines a 3D ridged border. The effect depends on the border-color value
  7. inset - Defines a 3D inset border. The effect depends on the border-color value
  8. outset - Defines a 3D outset border. The effect depends on the border-color value
  9. none - Defines no border
  10. hidden - Defines a hidden border
20
Q

Other border properties

A

Border-width: 5px; -> other values: medium, thick, etc.

Border-color: red;

21
Q

Define margins in 4 directions

A

margin-top: 100px;
margin-bottom: 100px;
margin-right: 150px;
margin-left: 80px;

22
Q

Basic styles height and width

A
  1. auto - This is default. The browser calculates the height and width
  2. length - Defines the height/width in px, cm, etc.
  3. % - Defines the height/width in percent of the containing block
  4. initial - Sets the height/width to its default value
  5. inherit - The height/width will be inherited from its parent value
23
Q

Adding external CSS

A

Each HTML page must include a reference to the external style sheet file inside the <link></link> element, inside the head section.

<link></link>

24
Q

Defining internal CSS

A

The internal style is defined inside the <style> element, inside the head section.</style>

25
When is inline CSS used?
To apply a unique style for a single element
26
How to use inline CSS?
To use inline styles, add the style attribute to the relevant element. The style attribute can contain any CSS property.
27
What is most common way to create layouts?
Using
elements is the most common way of creating layouts.
28
What does the div element allow for?
elements allow for creating blocks of content (combine parent display: flex with child float: left/right)