CSS Flashcards

1
Q

Advantages of seperate CSS stylesheet

A
  • Much easier site maintance
  • Greater typography and page layout control (general pro)
  • Potentially smaller documents
  • Can act as template for many webpages
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Anatomy of CSS selectors

A

Stylesheets are composed of “Rules” that describe the styling to be applied.

Each rule has the following composition:

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

types of CSS selectors

A

– HTML element name selector

– class selector

– id selector

– contextual selector

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

block vs inline elements (+ examples)

A

block elements
— start on a new line
— take full width available
— browser sets margin between block elements
— < div >, < p >, < h1 >, < form >

inline elements
— do not start on a new line
— take only necessary width
— must be nested inside a block element
— < span >, < img >, < a >

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

float property

A
  • a floating element is removed from the document flow
  • it hovers inside a container; can be left, right, or none
  • floating elements should have a width property, otherwise content may be unable to wrap around the floating element
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

clear property

A

disallows floating elements from overlapping this element; can be left, right, both, or none (default)

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

definiton of overflow property + 4 values

A

specifics what to do when element’s content is too large; can be auto, visible, hidden, or scroll

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

how to set up a multi-column layout

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

4 types of CSS positioning

A

static position: no special position; positioned according to the normal flow of the page and is unaffected by top, bottom, left, and right properties; the default

relative position: relative to its normal static position. Setting the top, right, bottom, and left properties of a relatively-positioned element will displace it from its normal static position.

absolute position: fixed position within containing element (nearest positioned ancestor). If no positioned ancestors, it uses the document body, and moves along with page scrolling.

fixed position: fixed position within browser window; sticky; element stays same place if page scrolled; can be top, right, bottom, and left; relative to viewport

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

what is optimal hierarchy in the process of layout

A
  1. alignment
  2. float
  3. position
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Details about inline boxes

A

use it sparingly, because it can radically alter you webpage

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

how can we control the viewpoint and what is the effect

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

one tool for CSS troubleshooting

A

Online CSS Validation

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

What is Bootstrap?

A

A free front-end framework for faster and easier web development

Includes HTML and CSS based design templates, as well as optional JavaScript plugins

Easily create responsive designs

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

Why Use Bootstrap?

A

Easy to use: only basic HTML and CSS required

Responsive features: adjusting to phones, tablets, and desktops

Mobile-first: mobile-first styles are part of the core framework

Browser compatibility: Bootstrap is compatible with all modern browsers

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

How can you apply styles to multiple elements?

A

grouping styles using commas

or

using classes in html

17
Q

What is the vertical-align property?

A

specifies where an inline element should be aligned vertically, with respect to other content on the same line within its block element’s box

18
Q

how to assign multiple classes to one element

A

by using spaces

< p class=”food pizza” >

19
Q

define pseudo-classes + 3 examples

A
  • Selectors that target an element under specific conditions
  • Defined by the state of the element
20
Q

what is this

selector1 selector2 {properties}

selector1 > selector2 {properties}

A

selectors seperated by spaces are contextual selectors

21
Q

properties of the CSS Box Model

A

every element is composed of:

  • the actual element’s content
  • padding between the content and the border (inside)
  • a border around the element
  • a margin between the border and other content (outside)
22
Q

Where does the border line go in the box model?

A

between the padding and the margin

23
Q

what are the following values for the border property

h2 { border: value1 value2 value3; }

A

value1 = thickness (1px, 2em, …)

value2 = style (solid, dotted, …)

value3 = color

24
Q

How to center a block element and an inline element?

A

to center inline elements within a block element: text-align: center;

recommended to set width (otherwise, may occupy entire width of page)

25
Q

display property + 3 examples

A

specifies the display behavior (the type of box model) of an element

inline - displays an element as an inline element. Any height and width properties will have no effect

block - displays an element as a block element. It starts on a new line, and takes up the whole width

inline-block - displays an element as an inline-level block container. The element itself is formatted as an inline element, but you can apply height and width values

Disclaimer: use it sparingly because it can radically alter layout

26
Q

Embedded Fonts and Alternatives

A
27
Q

one use of < span >

A

an inline element used for applying styles

28
Q

3 ways to glue the style to HTML

A

1) External Stylesheets (separate document - best way)
2) Internal Stylesheets (inside html < style > - hard to maintain)
3) Inline style (inside tag - very hard to maintain)

29
Q

Hierarchy Rules

A
  • Tag values will be inherited by descendants.
  • when styles conflict, the latter style takes precedence
  • more specific rules override a more general inherited rule