The Box Model, Block and Inline, Flexbox Flashcards
What is the difference between padding, margin, and border?
Padding: the space between the content and the borde
Margin: the space between a box and others that sit next to it
Border: the space between the margin and the padding.
True or False: If two boxes are next to each other and they both have the margins that are 60px, they stack.
False! They do not stack, instead the margins just combine which in this case will result in 60px between the two boxes. Margin’s collapse!
What is the difference between Block and Inline elements? What are some examples of those elements?
Block elements display as a block and stack on top of each other and start on a new line on a page. Example: <h1> <p> <div>
Inline elements do not display as a block or start on a new line. Instead, they take space inside of a block element. <em> <a> <span></span></a></em>
What are the two empty HTML elements that do not have any particular meaning to them and are generic boxes that can contain anything? One is a block element and one is an inline element.
<div> and <span>, block and inline in that order.
</span></div>
What is Normal Flow?
How elements on a web page lay out by default without CSS to change the way they behave.
(Flexbox) What is Flexbox and what is it used for?
Flexbox is a tool used to format and layout a web page into rows or columns using flex containers and flex items. These items will flex, grow shrink, based on rules you can define.
(Flexbox) What is a flex container and a flex item? What is their relationship?
A flex container is a box that holds flex items (that are also boxes cuz HTML). Flex items can also be flex containers that can hold flex items!
(Flexbox) What is the flex declaration and what are the three properties it is a shorthand for?
The flex declaration is a short hand for 3 properties you can set on a flex item: flex-grow, flex-shrink, flex-basis. The flex declaration determines how a flex item flexes or stretches inside a flex container. It usually only contains one value as a shorthand and the declaration is placed into the styling of the container or an individual item.
(Flexbox) What does flex-grow do?
The first part of the flex shorthand that determines how flex items grow in a flex container.
(Flexbox) What does flex-shrink do?
The second part of the flex shorthand that determines how flex items shrink in a flex container.
(Flexbox) What does flex-basis do?
The third part of the flex shorthand that determines the initial size of a flex item. Any sort of growing or shrinking will start from that baseline size.
(Flexbox) What are the two axes of a flex container?
The main axis (aka the primary axis) that follows the flex direction: row (left to right) or column (top to bottom).
The cross axis is perpendicular to the main axis where the children will be stretched out to fill the entire container along this axis. Opposite directions of the main axis.
(Flexbox) What does justify-content property do?
Aligns flex items based on the main axis.
(Flexbox) What does align-items property do?
Align flex items based on the cross axis.
(Flexbox) What does the gap property do?
Adds a specified space between flex items. Similar to margin!