CSS Flashcards
Advantages of seperate CSS stylesheet
- Much easier site maintance
- Greater typography and page layout control (general pro)
- Potentially smaller documents
- Can act as template for many webpages
Anatomy of CSS selectors
Stylesheets are composed of “Rules” that describe the styling to be applied.
Each rule has the following composition:

types of CSS selectors
– HTML element name selector
– class selector
– id selector
– contextual selector
block vs inline elements (+ examples)
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 >
float property
- 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
clear property
disallows floating elements from overlapping this element; can be left, right, both, or none (default)

definiton of overflow property + 4 values
specifics what to do when element’s content is too large; can be auto, visible, hidden, or scroll

how to set up a multi-column layout

4 types of CSS positioning
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
what is optimal hierarchy in the process of layout
- alignment
- float
- position

Details about inline boxes
use it sparingly, because it can radically alter you webpage
how can we control the viewpoint and what is the effect

one tool for CSS troubleshooting
Online CSS Validation
What is Bootstrap?
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
Why Use Bootstrap?
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 can you apply styles to multiple elements?
grouping styles using commas
or
using classes in html
What is the vertical-align property?
specifies where an inline element should be aligned vertically, with respect to other content on the same line within its block element’s box

how to assign multiple classes to one element
by using spaces
< p class=”food pizza” >
define pseudo-classes + 3 examples
- Selectors that target an element under specific conditions
- Defined by the state of the element

what is this
selector1 selector2 {properties}
selector1 > selector2 {properties}
selectors seperated by spaces are contextual selectors

properties of the CSS Box Model
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)

Where does the border line go in the box model?
between the padding and the margin
what are the following values for the border property
h2 { border: value1 value2 value3; }
value1 = thickness (1px, 2em, …)
value2 = style (solid, dotted, …)
value3 = color
How to center a block element and an inline element?
to center inline elements within a block element: text-align: center;
recommended to set width (otherwise, may occupy entire width of page)

