Code Fellows Notes
<div>
elements are often used as containing elements to group together sections of a page.float
property moves content to the left or right of the page and can be used to create multi-column layouts. (Floated items require a defined width).display
property does two things. The first thing it does is determine if the box it is applied to acts as inline or block.<span>
and <strong>
, which are typically used to style pieces of text within containing elements like a <p>
(paragraph), are inline by default. They also preserve surrounding whitespace.display
property also determines how an element’s children should behave. For example, setting the display
property to display: flex
makes the box a block-level box, and also converts its children to flex items. This enables the flex properties that control alignment, ordering and flow.align-items
, justify-content
and flex-wrap
properties.flex
property.display: grid
, and introduces a few new primitives for layout styling, such as the repeat()
and minmax()
functions. One useful grid unit is the fr
unit—which is a fraction of remaining spacegrid-row
and grid-column
properties instruct the first element in the grid to span to the start of the fourth column, from the first column, then span to the third row, from the first row.inline-block
gives you a box that has some of the characteristics of a block-level element, but still flows inline with the text.float
property instructs an element to “float” to the direction specified. You can instruct an element to float left
, right
or inherit
.column-width
. As more space is made available in the viewport, more columns will automatically be created and as space is reduced, columns will also reduce.relative
, absolute
, fixed
and sticky
with the default value being static
.position
to absolute
, it breaks the element out of the current document flow. This means two things:
top
, right
, bottom
and left
in its nearest relative parent.position
value of fixed
behaves in a similar way to absolute
, with its parent being the root <html>
element. Fixed position elements stay anchored from the top left based on the top, right, bottom and left values that you set.fixed
and the more predictable document flow-honoring aspects of relative
by using sticky
. With this value, as the viewport scrolls past the element, it stays anchored to the top, right, bottom and left values that you set.Other References