CSS Flashcards

1
Q

CSS Rule

A

Selectors, Values, Properties, Declarations

div {
line-height: 1.8em;
}

above “div” is the selector
“line-height” is the property
“1.8em” is the value
and “line-height: 1.8em;” is the declaration

Selectors select which HTML elements we’re edditing
The Property is the thing we are styling about that element
The Value is how we are going to style it
The Declaration is made up of the Property and the Value

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

Class, ID, and Universal selectors

A

Select by class .class-name
Select by ID #id-name
Select everything *

(if you have class you’re on point -Dane Dawson)

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

Pseudo Selectors

A

Allow us to choose HTML elements in special states

\:visited
\:hover
\:nth-child()
\:not
\:after
\:selection
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Competing Rules and Specificity

A

If you style an element more than once, the most recent styling is the one that will show up

.nav {
  color: gold;
}
.nav {
  color: blue;
}

It’s gonna be blue

HOWEVER! There’s also a hierarchy. So if you style an h3 with an ID and then later you style all the h3s, the one with the ID will not change because it is more specific

  1. ID
  2. classes, attributes, and psudo-classes
  3. elements and pseudo-elements
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Attribute Selectors

A

You can select an input with a specific type like this:
input[type=”text”]
and it will style all the inputs with a text type

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

Colors

A

CSS Color Names: 140 preset colors that you can choose by name (i.e. blue, pink, red, black)

Hex Codes: over 16million colors that are compatable with almost, if not all browsers. 0-9 and A-F, 0 is the least intense and F is the most - #00000000 is white #ffffffff is black, Value order is red, green, blue, alfa, can be 3-8 character long.

RGBA Colors: over 16million colors, can be manipulated by JavaScript, compatable with almost, if not all browsers, 0 is least intense, 255 is most, red=red, g=green, b=blue, a=transparency rgb(0,0,0) is white rgb(255,255,255) is black rgb(255,0,0) is red

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

Sizing

A
px=pixels
    based on screen pixels
    easy to understand
    hard to keep consistent
%=percentage of parent container
    good for browser resizing
    works best with width
    difficult to maintain a ratio
em
    based on browser/user's default base font
    default base is usually 16px so 1em=16px
    most consitent
vw/vh=viewport
    1vw is 1% of the viewport width
    setting the hieght is more intuitive
    sizing fonts with this is not recommended
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Fonts and Text

A

Everything has a default font so when in doubt use:
“serif”, “sans-serif”, “monospace”, or “cursive”

You can also import fonts for further customization

font-weight makes something thinner or bolder

Text customization and decoration can add strikethroughs, underlines, alignment, and shadow

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

Combinator Selectors

A

Grouping (combination) and descendant selectors

, = combination (will style everything combined)
{space} = all descendent children
> = a direct child
~ = all general siblings (div ~ p will modify all div elements that are siblings to all p elements)
\+ = an adjactent sibling (h3 + p will modify all p elements immediately after h3 elements)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Every HTML element has default box properties made up of:

A

Content: generally text, will adjust to the max width allowed by container or viewpoint, once it hits its max width, it will auto expand its height

Padding: Space around the content but still inside the container or viewpoint. It’s transparent

Border: wraps around the padding and content

Margin: space around the border

Using one value will set all four sides as the same
first value: top(and bottom)
second: right(and left)
third (if applicable): bottom
fourth: (if applicable): left
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does the total width include?

A

Border, Padding, and Content

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

display:block

A

takes up full width of viewpoint
cannot add anything adjacent
can decrease width and center

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

display:inline

A

Will be on the same line as other elements

Cannot adjust height or width - controlled only by content

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

display:inline-block

A

Inline with the ability to edit height and width

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

Box Model

A

The HTML element box

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

Types of Positioning

A

Static: with default value, elements follow the normal flow of the document - not effected by top, bottom, left, and right properties

Relative: relative to its default position - setting top, bottom, left, and right properties will move the content from its original position

Absolute: relative to nearist positioned ancestor - removed from the normal flow, can overlap other elements - if there’s no ancestor, it uses the body

Fixed: relative to the viewpoint - it will always stay the same if the page is scrolled

Sticky: based on user’s scroll position, toggles between relative and fixed. Will act relative until it reaches the top of the page when scrolling and then remains fixed until you scroll back up

17
Q

Z-Index

A

Determines the element’s position in a stack.

Default is 0

18
Q

Properties for Animation

A

Transform:
Changes elements immediately
Can define the end state
Transition:
Animates elements over a specified duration
Can define beginning and end state
Animation:
Animates elements over a specified duration, can be looped.
Can define beginning, end, and all states in between
@Keyframes
Allows for defining multiple states

19
Q

Flex Containers

A

Parent/Flex
declare display:flex to make an element a flex parent/container
display:flex only impacts direct children
elements inside a flex can be flex containers as well
Children/Flex Items
any direct children of an elemtn with display:flex are flex children/items
there are separate properties for containers and items

20
Q

Why do you need to design multiple layouts

A

Many people visit websites on mobile devices
Many will continue to use the mobile version more often than the desktop
Width, height, and overall size of a desktop monitor are different vs. a mobile screen are quite different
A varierty of layout strategies are needed

21
Q

Media Queries

A

Media Queries allow you to style two different sized sites

@media - the media query rule
(min-width: 600px) the condition for when the media query styles will apply
{…} the CSS styles to apply when the media query is in use.

22
Q

First steps of designing

A

Wireframe - rough skeleton - just boxes
Mockup - fully designed - not code
Prototype - what you show the client before launch

23
Q

Bootstrap

A