CSS (Cascading Style Sheets) is the fundamental cornerstone of web design, providing developers with the precision to craft visually appealing and user-centric websites. Our comprehensive css cheatsheet in tabular format offers an exhaustive guide to over 40 pivotal CSS properties, values, and expert tips for creating remarkable, adaptive, and engaging designs. Ranging from advanced layout techniques to captivating animation effects, this exhaustive resource serves as your go-to reference for mastering the art of CSS.

On This Page

CSS Cheatsheet

CategoryProperty / FeatureSyntax / ExampleDescription / Notes
Text Stylingcolorcolor: red;Sets the text color
font-familyfont-family: Arial, sans-serif;Defines the font family
font-sizefont-size: 16px;Specifies the text size
font-weightfont-weight: bold;Controls the thickness of text
line-heightline-height: 1.5;Sets the space between lines
text-aligntext-align: center;Aligns text horizontally
text-transformtext-transform: uppercase;Controls text capitalization
text-decorationtext-decoration: underline;Adds or removes text decoration
letter-spacingletter-spacing: 2px;Adjusts the spacing between letters
word-spacingword-spacing: 5px;Adjusts the spacing between words
white-spacewhite-space: nowrap;Prevents text from wrapping to a new line
directiondirection: rtl;Sets text direction (e.g., right-to-left)
Box Modelmarginmargin: 10px;Defines space outside the element
paddingpadding: 10px;Defines space inside the element
borderborder: 1px solid black;Specifies the border style
widthwidth: 100%;Sets the width of an element
heightheight: auto;Sets the height of an element
box-shadowbox-shadow: 2px 2px 5px gray;Adds shadow around the element
border-radiusborder-radius: 10px;Rounds the corners of an element
outlineoutline: 2px dotted red;Adds an outline without affecting layout
outline-offsetoutline-offset: 5px;Specifies space between the outline and element
box-sizingbox-sizing: border-box;Includes padding and border in element dimensions
Backgroundbackground-colorbackground-color: lightblue;Sets the background color
background-imagebackground-image: url('image.jpg');Adds a background image
background-sizebackground-size: cover;Specifies the size of the background image
background-positionbackground-position: center;Positions the background image
background-repeatbackground-repeat: no-repeat;Prevents background from repeating
background-clipbackground-clip: text;Clips background to the element’s text
background-attachmentbackground-attachment: fixed;Controls background scroll behavior
Positioningpositionposition: relative;Specifies the position of an element
top, left, etc.top: 10px; left: 20px;Moves the element relative to its position
z-indexz-index: 10;Sets the stack order of elements
displaydisplay: flex;Defines how an element is displayed
overflowoverflow: hidden;Controls content overflow
floatfloat: right;Floats an element to the left or right
clearclear: both;Prevents an element from wrapping around floated elements
Flexboxdisplay: flex;display: flex;Enables flexbox layout
justify-contentjustify-content: center;Aligns items horizontally
align-itemsalign-items: center;Aligns items vertically
flex-wrapflex-wrap: wrap;Wraps items within the container
flex-growflex-grow: 1;Defines how items grow to fill space
Griddisplay: grid;display: grid;Enables grid layout
grid-template-rowsgrid-template-rows: 100px 200px;Defines row heights
grid-template-columnsgrid-template-columns: 1fr 2fr;Specifies column widths
gapgap: 10px;Sets space between grid items
Animationsanimationanimation: slideIn 2s ease-in-out;Adds animation to an element
@keyframes@keyframes slideIn { from { ... } to { ... } }Defines animation keyframes
transitiontransition: all 0.3s ease;Smooth transitions for property changes
Responsive Design@media@media (max-width: 600px) { ... }Applies styles for specific screen sizes
Shapes & Filtersfilterfilter: blur(5px);Applies graphical effects like blur, brightness
transformtransform: rotate(45deg);Rotates, scales, or skews an element
Pseudo-elements::beforecontent: ''; position: absolute;Inserts content before an element
::aftercontent: '';Inserts content after an element
Other Featurescursorcursor: pointer;Changes cursor style (e.g., pointer, default)
visibilityvisibility: hidden;Hides an element without removing it from flow
clip-pathclip-path: circle(50%);Clips an element into a specific shape

FAQs

What are the most commonly used CSS properties?

Properties like color, margin, padding, display, font-family, position, and background are among the most frequently used in CSS.

Are CSS cheat sheets suitable for beginners?

Absolutely! CSS cheat sheets are designed to be simple and accessible, providing beginners with a structured way to learn and reference CSS properties.

How does CSS help in responsive web design?

CSS enables responsive design through media queries, flexible layouts (e.g., Flexbox, Grid), and relative units (e.g., percentages, em, rem), ensuring websites work well on all devices.

What are some advanced CSS techniques included in cheat sheets?

Techniques like keyframe animations, transitions, pseudo-elements, custom properties (CSS variables), and filters are often part of advanced CSS cheat sheets.

Is there a difference between CSS and SCSS/SASS?

Yes, SCSS/SASS are preprocessors that extend CSS with features like variables, nesting, and mixins, making stylesheets more maintainable.

What tools or resources are helpful for mastering CSS?

Tools like browser dev tools, online code editors (e.g., CodePen, JSFiddle), CSS frameworks (e.g., Bootstrap, Tailwind), and cheat sheets can significantly aid in mastering CSS.

You May Also Like

More From Author

+ There are no comments

Add yours