CSS basic Flashcards

1
Q

CSS (The cascade)

A

Determines which styles are applied when multiple rules target the same element.
The last rule written is the winner

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

Final applied color?

h1{
color: blue;
}
h1{
color: green;
}

A

Final applied color is green, because it was declared last

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

Calculating specifity

ID selector 1-0-0 highest
Class selector 0-1-0
Type selector 0-0-1

A

food {

HTML

<p> ....</p>

CSS

     background: green;
        } p{
      background: orange;
 }

So here the winnes is green because ID selector weight

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

CSS property values

COLORS there are 4 primary ways:

A

*Keyboards: black, silver (name that map to a given color)

*Hexadecimal notation: #0000, Hc0c0c0

*RGB values: rgb (0,0,0), rgb (192,192,192,)

*HSL values: hsl (0,0%, 75%)

Note that for example Hexadecimal way have a more range in comparison to keyboard

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

Lenght values

Fundamental unit of measurement used to define sizes, spacing, positioning and other layout properties. (width, height, padding, margin, space between elements ..)

Is divided in 2 types???

A

Absolute: Don´t provide flexibility

Relative: Is flexible and adapt based on context. Best for (responsive design) –>Allows a web to ajust to the size of a screen

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

*Absolute lenght units
best for print styles

A

px –> pixeles –> 1px (1 dot on the screen)

cm –> centimiter –> 1cm=37.8 px

mm

in

pt –>point used in prints –> 1 pt = 1.33 px

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

*Relative Lenght units

A

em –> Font size of the element
1 em= current font size

% –> Percentage of the parent element, so works based on the parent element size

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

Display
(Mostrar, pantalla)

A

Defines how an HTML element is rendered on the webpage

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

Display
¿What are the ways for displaying?

A

*None
*Block
*Inline
*Inline-Block
*Flex
*Grid

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

Block display

A

*Occupies the entire width of the container
*Always initiate a new line
Ex: <p>, <h1>, <section>, <article>

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

None

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

Inline Display

A

*Do not initiate a new line
*Only occpies the width of the content
Ex: <span>, <a>, <strong>, <em></em></strong></a></span>

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

Inline-Block Display

A

It behaves as inline (don´t initiate a new line) but allows width and heigth
Useful for bottons, images and menus ….

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

Flex Display

A

Converts the container to a flexbox, allowing an advanced distribution
The sons can get aligned, justifiyed and reordered easier

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

Grid (cuadrícula)

A

Useful for column design and filas

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

Box Model

A

How elements are structured and spaced on a web page

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

Box model elements

A

Content
Padding
Border
Margin

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

Box Model: Content

A

Espacio interno donde se muestra el texto o imagen

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

Box model: Padding

A

Espacio entre contenido y borde

Aumenta el tamaño interno del elemento

By default we have padding izq+padding derecho

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

Box model: Border

A

Línea alrededor del padding y contenido

Se puede personalizar con color, grosor y estilo

Se calcula izq y derecha

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

Box Model: margin

A

Espacio entre elemento y otros elementos

Cuando 2 elementos con margin se encuentran, no se suman, se toma el de mayor valor

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

Box model calculation size

A

It is calculated sum up all their parts

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

Example box sizing

In this case we hace total width: 200px

A

box{
box-sizing: border-box;
width: 200px;
padding: 20xp;
border: 5px solid black;
margin: 15px;
}

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

Positioning content with floats

A

Used for:

°Floating images with text wrapping

°Creatingcolumn-based layouts

°Positioning elements inside containers

°Making navigation menus or sidebras

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

Values of float property

A

Floats the element to the left or right of its container (left & right values)

26
Q

Clearing floats
(Clearing property)

A

Ensures that the layout remains structured

Values: left, right and both

27
Q

.clearfix technique

28
Q

Difference between font and typeface

A

Font is the file that contains typeface, meaning that allows the computer to acces type face

29
Q

Font-family

A

Defines the typeface (font) used for the text

It accepts multiple font names as a fallback system in case the first isn´t available in the browser

30
Q

font-family synthax

A

p {
font-family: “Times New Roman”, serif;
}

If the font name has 2 or more words needs to be wrapped in quotiation marks

31
Q

font-size values

A

°Pixels

°Em: Relative to the parent element

°Rem: Relative to the root element

°Percentage: Relative to the parent font size

°Viewport units: vw (vp width)
vh(vp height)

32
Q

font-style values

A

°Normal: by default

°Italic:

°Oblique: Similiar to Italic

33
Q

font-variant values

A

Controls small caps (uppercase letters that are slightly smaller than regular uppercase)

34
Q

Inheritance properties

A

Font-family, font-size, font-style and font-variant are inheritable by default, meaning child elements will get these values

35
Q

font-weight values

A

It accepts keyboard values and numeric values

°Keyboard values: Normal, bolder, lighter, and inherit.

°Numeric values:
100-thin
200 extra-light
300 light
400 normal
………
700 bold

36
Q

line-height property

Synthax:

{
line-height: normal;
}

A

Controls the vertical space between lines of text

Values:

Normal: by default
Number: 1.5
Lenght: px, em, rem
Percentage: %
Inherit

38
Q

Shorthand Font

*Note: every property value is optional excet font-size and font-family

A

font-style font-variant font-weight font-size/line-height font-family;

Examle:

p{
font: italic small-caps bold 16px/1.5 arial;
}

39
Q

Hover
(pseudo class)

A

Styles an element when a user hovers over that element (changing the color when user put the mouse on it)

40
Q

Text properties

A

*Text align
*Text decoration
*Text indent property
*Text transform
*Letter spacing property
*Word spacing

41
Q

Text align property values

p{
text-align: center;
}

A

left
right
center
justify
inherit

42
Q

Text decoration property
(Spruce it up text)

h2{
text-decoration-line: underline overline;
}

A

*None: removes any default text decoration (useful for links)
*Underline: Adds a line below text
*Overline: Adds a line above text
*Line-throughs: Adds a line through text

43
Q

Text indent property

A

For indenting the first line of the text within an element

p{
text-indent: 20px;
}

44
Q

Text transform property

A

*None: Will return any of these inherited values back to original
*Capitalize: Capitalize the 1st letter of each word
*Uppercase: Capitalize every letter
*Lowercase: Every letter lowe case
*Inherit

45
Q

Letter spacing property

A

Adjust the space between the letters on a page
Default: 0.5 cm closer

46
Q

Word spacing

A

Spaced by default 0.25 em apart

47
Q

Embedding web fonts

(I can use web fonts from: Google fonst website, typekit, self-hosted, system fonts, etc.)

A

Using google fonts (easy method), steps:

Go to google fonts
Select a font
Copy the link tag for embedding
Add it inside the head (HTML)

Using self-hosted fonts (best control, better performance)

*woff2
*woff files

48
Q

For self-hosted fonts
How we define the font?

A

Using: @font-face

@font-face{
font-family: ‘Poppins’;
src: url(‘/fonts/Poppins-
Regular.woff2’) formal(‘woff2’);
url(‘/fonts/’…..Regular.woff’) format(‘woff’);
font-weight: 400
font-style: normal;
}

Then apply

body{
font-family: ‘Poppins’, sans-serif;
}

49
Q

Background-color property

A

selector: HTML element I want to style

selector{
background-color: rojo;
}

50
Q

Background-image

I can control position, size, repeat behavior and other aspects

A

selector{
background-image: url(“image.jpg”);
}

51
Q

Background-repeat
(repeating the image)

Values??

A

By default, background images repeat in both directions

Values:

background-repeat: no repeat;

background-repeat: repeat-x;

background-repeat: repeat-y;

52
Q

Background-position

A

Requires 2 values:

Horizontal offset (1°) and vertical offset (2°)

If only 1 value is specified, that value it will used 50%-50%, horizontal and vertical.

*We can use the “top, right, bottom, left & center keywords, pixels, percentages or any length measurement.

53
Q

Shorthand background image values

A

1 Background-color
2 Background-image
3 Background-position
4 Background-repeat

1, 2, 3, 4

54
Q

Gradient background
Synthax?

A

selector{
background: linear-gradient(direction, color1, color2, …);
}

55
Q

Setting background direction

A

Keywords: to right, to bottom, etc

Angles: degress, like 45 deg, etch

I can control where each color starts

red starts at 10%, yellos starts at 50% and so on

56
Q

Another background properties

For maintaining the ratio. Which value we use?

57
Q

Another background properties
The “cover” keyword value
What it is for?

A

Specifies that the background image will be resized to completely cover element´s width and height.
Often the image is cut off to occupy the full available space

58
Q

Another background properties
The “contain” keyword
What it is for?

A

Specifies the background image will be resized to reside entirely contained within an element width and height (aspect ratio will be preserved)

*It could happen that it will not occupy the full available space of the element

59
Q

Background-clip property

What determines?

A

Determines how far the background extends inside an element

Synthax:
values ( border-box default, padding-box, content-box)

background-clip: value;

60
Q

Back-ground origin property

What does control?

A

Controls where the background image starts withing an element

Synthax:
values (boder-box default, padding-box, content-box)

background-origin: value;