Intermediate CSS Flashcards
<div></div>
Combines a group of html elements into a single box
Useful to structure and divide up web content
<span></span>
An inline element where you can use to pick a sub-section of a html element, which can then be used to style
The Box Model
Width Height Padding Border Border Size Solid, Dashed, … Margin
Display Property
We can also modify the display property for any html element
Ex. display : inline;
Block
An element that will take up its own line, where the width takes up the whole screen
Inline/ Inline-Block
Inline
Inline-Block
Allows other elements to sit to their left or right side
None
Html element is hidden as if it never existed
Alternative, visibility : hidden
The element can not be seen, but it fills the original size position
CSS Static and Relative Positioning
- Content dictates everything
- Order of content comes from the code
- Parent - Children relationship
Children elements are layered on top of the parent elements
Position
4 Methods to change the layout positioning of elements:
Static
All html elements are static by default
Relative
The adjustment position is applied in relative to the static positioning
position : static;
Then we can only see changes once we change the coordinate values.
top, bottom, left, right
Relative positioning acts independently on the html element
Absolute
Moves element relative to its parent element
Adds margins relative to its parent element
Absolute positioning acts dependently on the html element
Fixed
The element will be fixed in place, even when the user scrolls around the web page
Useful for navigation bars
Centering Elements with CSS
text-align : center
Centers all elements, where it does not have a width set
margin : top right bottom left
auto - will be used to center the element
Font Styling
font-family
serif
sans-serif
Note that the availability of fonts varies based on…
…the browser and operating system. So if you choose a font for your web site, be mindful of its availability to your end users.
em
Example.
font-size: 2rem;
1 em = 16px = 100%
Dynamic sizing of text, in proportion to a standard, being 16px = 1em
Dynamic sizing of text, relative to the html elements paren
rem
Dynamic sizing of text, relative to the root
Preferable to use for texts
CSS Float and Clear
float
The html element “floats”, so that other elements can wrap around the element
clear
Opposite of float, the html element does not allow wrapping around of other elements