Here’s a cheat sheet covering some common and essential CSS properties:
Typography
Font Family:
body {
font-family: "Arial", sans-serif;
}
Font Size:
h1 {
font-size: 24px;
}
Font Weight:
p {
font-weight: bold;
}
Text Alignment:
.center-text {
text-align: center;
}
Line Height:
.double-space {
line-height: 2;
}
Colors and Background
Color:
.text-color {
color: #336699;
}
Background Color:
.background-color {
background-color: #f0f0f0;
}
Background Image:
.bg-image {
background-image: url('background.jpg');
background-size: cover;
}
Box Model
Width and Height:
.box {
width: 200px;
height: 100px;
}
Padding:
.box {
padding: 10px;
}
Border:
.box {
border: 2px solid #000;
}
Margin:
.box {
margin: 20px;
}
Box Sizing:
.box {
box-sizing: border-box;
}
Layout
Display:
.block {
display: block;
}
.inline {
display: inline;
}
.none {
display: none;
}
Position:
.relative {
position: relative;
}
.absolute {
position: absolute;
}
.fixed {
position: fixed;
}
Float:
.float-left {
float: left;
}
.float-right {
float: right;
}
Flexbox and Grid
Flex Container:
.flex-container {
display: flex;
}
Grid Container:
.grid-container {
display: grid;
}
Responsive Design
Media Query:
@media screen and (max-width: 600px) {
/* CSS rules for screens with a maximum width of 600px */
}
Responsive Images:
img {
max-width: 100%;
height: auto;
}
These are just a few examples, and there are many more CSS properties and values you can use. This cheat sheet provides a quick reference for common properties used in web development. Adjust the values based on your specific styling requirements.