CSS Flashcards

1
Q

Display types: Inline

A

Inline is the display type of most tags meant to be interspersed with text. Examples include a, strong, span and time.

Inline elements always keep their “line height”. This causes properties like margin and padding to behave strangely.

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

Display types: block

A

Block elements differ from inline ones in that they do not respect line height. By default, block elements take up as much horizontal space as possible. Additionally, they do respect width and height properties.

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

Display types: Inline block

A

Inline block elements are a combination of the block and inline elements. They do remain inline, but they force elements around them to respect both horizontal and vertical space. You can set the width and height properties of an inline block element.

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

Display types: none

A

display: none removes the content from the (visible) page. Note that the element is still in the HTML and is viewable in the page’s source. It just isn’t rendered.

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

Display types: flex

A

A W3C Last Call Working Draft module called Flexbox (Flexible Box) provides display: flex. It’s still not fully supported, but it’s pervasive and powerful enough to be used by modern web pages.

The Flexbox Layout provides a more efficient way to align and distribute space by styling “Flex containers” that automatically calculate the sizes of their children.

This brings up two main categories for all Flexbox properties:

“Properties for the Parent” (Flex Containers)
“Properties for the Children” (Flex Items)
To make an element into a Flex Container we simply give it the display: flex property. This attribute makes all child elements into Flex Items. The size of each flex item is then calculated to always fit within the container. The default direction of these elements is horizontal but can be easily changed with flex-direction.

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

Steps to make a clock

A

1) Create hand divs that are stacked up on each other.
2) We want to rotate these divs somehow.
3) We want to use transform-origin 100% so that the axis starts at the end of the hand at the center of the div.
4) Now we are free to use the rotate(num deg) method.
5) we use transition-timing-function and a transition: all (secs)
6) in JS, we want to write a setDate function.
7) set up a new date and get the seconds from that using receiver.getSeconds();
8) From there, translate to degrees by dividing by 60. and multplying the quotient by 360

9) using a querySelector and passing in the appropriate hand (saing to a variable):
hand. style.

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

What is a media query?

A

It uses the @media rule to include a block of CSS properties only if a certain condition is true.

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

What is a breakpoint?

A

Using a media query, we can set which part of the page design will behave differently depending on the values of its class.

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

What does it mean to Design for Mobile First?

A

Mobile First means designing for mobile before designing for desktop or any other device (This will make the page display faster on smaller devices).

Instead of changing styles when the width gets smaller than 768px, we should change the design when the width gets larger than 768px. This will make our design Mobile First:

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

Orientation: Portrait/Landscape

A

Media queries can also be used to change layout of a page depending on the orientation of the browser.

You can have a set of CSS properties that will only apply when the browser window is wider than its height, a so called “Landscape” orientation:

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

CSS Variables:

A

We can update these variables on any element and the selectors on the element.

Syntax:

\:root {
--base: (color of choice)
--spacing: (num px)
--blur: (num px)
}

Now we can apply any of these things to our tags.

img {
padding: var(–spacing);
background: var(–base);
}

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

Dataset?

A

Dataset is an object that will contain data attributes.

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

What does height inherit do and when should we use it?

A

ewfrwer

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

flex panels: How to get the panels to evenly distribute space?

A

Flex: 1 - all panels evenly distribute. Any child containers with different flex numbers will adjust to the parent proportionally (flex: 5 in a child will expand the div 5x size).

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

Whats an effective way to visually gauge flexboox activity?

A

open up console and make borders a unique color.

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

flex panels: Why would we want to nest flex containers?

A

If we have text that we want placed in a specific manner across flex boxes.

17
Q

What does :first-child or :last-child mean?

A

apply certain visual characteristics to

18
Q

What does translate X/Y mean?

A

shifts content across the div.

19
Q

What vanilla JS functions do we use to grab CSS classes?

A

document.querySelector or document.querySelectorAll

20
Q

What vanilla JS function toggles class activity?

A

receiver.toggle(‘class’)

21
Q

without jQuery, how can we click on something and have it execute _ function?

A

receiver.addEventListener(‘click’, func)

22
Q

CSS Grid Layouts.

A

Whats bad about Bootstrap:
It moves the HTML around and makes things unstable.

Float and Flex are hacks.

Main sections:
grid container
grid item 
grid line 
grid cell 
grid track 
grid area 
grid gap
23
Q

CSS Grid Layouts: Container

A

Element containing a grid defined by setting

display: grid;

24
Q

CSS Grid Layouts: Line

A

Grid lines are referenced by number, starting and ending with the outer borders of the grid.

25
Q

CSS Grid Layouts: item

A

Element that is a direct descendant of the grid container,

26
Q

CSS Grid Layouts: cell

A

The intersection between a grid row and a grid column. Effectively the same as a table cell.

27
Q

CSS Grid Layouts: area

A

Rectangular area between four specified grid lines. Grid areas can cover one or ore cells,

28
Q

CSS Grid Layouts: track

A

The space between two or more adjacent grid lines. Row tracks are horizontal, Column tracks vertical

29
Q

CSS Grid Layouts: gap

A

Empty Space between grid tracks aka gutters,

30
Q

CSS Grid in a nutshell

A

1) Define a grid

2) Place items within the grid

31
Q

CSS Grid: Practical approach

A

1) build accessible moblfirst layout without grid
2) Use mobile-first layout as fallback for all browsers
3) Use @supppors to detect grid support
4) at the appropriate breakpont, create layout with grid and grid-areas
5) Explore new layouts as viewport widens.