CSS Box Model Flashcards
(36 cards)
Padding
-Separates the content from the border
Margin
-Area outside the border and is used to control the space between other elements.
-Vertical margin and horizontal margin
Code:
auto (centers the page)
margin: 2px //top and bottom 0 //left and right
Div element
Code:
<div></div>
Add divisions to a page
Link
- Self closing element
- You can link the CSS file here
Border shorthand
.class {
border: line-width line-style color
Overflow
Filter
-Applying filters
Code used:
filter: blur(2px);
Box-shadow
Border-radius
Defines the border radii with pixels. Rounds the edges
Transform
Can rotate an object in degrees
Code:
transform: rotate(0.6deg) (can also use negative to rotate the opposite direction
Meta
-Goes in the head element
Code:
name=”viewport”
content=”width=device-width, initial-scale=1”
Box-sizing
Display using flex
Flexbox
Flexbox is a one-dimensional CSS layout approach that focuses on the flow of content. It offers the ability to control the way items are spaced and aligned within a container.
Flex direction
Specifies how flex items are placed in the flex container, by setting the direction of the flex container’s main axis.
Flex-wrap
Controls whether the flex container is single-line or multi-line, and the direction of the cross-axis, which determines the direction new lines are stacked in.
Justify-content
Aligns flex items along the main axis of the current line of the flex container.
Align-items
Aligns flex items along the cross axis of the current line of the flex container.
Object-fit
Specifies how the contents of a replaced element should be scaled relative to the box established by its used height and width.
Font-weight
Makes text bolder
Letter-spacing
Spacing between letters (pixels)
Float
The float property is used to place an element on the left or right of its container, allowing other content (such as text) to wrap around it.
Rem
The rem unit stands for root em, and is relative to the font size of the html element.
Create an .sm-text selector and set the font-size to 0.85rem, which would calculate to be roughly 13.6px (remember that you set your html to have a font-size of 16px).
:not Pseudo selector
The :not pseudo-selector can be used to select all elements that do not match the given CSS rule.
Code:
div:not(#example) {
color: red;
}