CSS3 Properties List
https://tamimwahid.com/wp-content/uploads/2020/04/trydo-blog-new-10-3.jpgCSS3 introduced a range of new properties and features that significantly improved web design capabilities. These properties provide more control over layout, presentation, and interaction. Here’s a list of key CSS3 properties along with their use cases:
1. Layout Properties
flexbox
(display: flex
)- Simplifies layout design by allowing flexible, responsive layouts.
- Use case: Aligning and distributing items within a container.
.container { display: flex; justify-content: center; align-items: center; }
grid
(display: grid
)- Provides a powerful grid-based layout system.
- Use case: Creating complex two-dimensional layouts.
.grid-container { display: grid; grid-template-columns: repeat(3, 1fr); }
box-sizing
- Changes the box model to include padding and borders in the width/height.
- Use case: Prevents unexpected size calculations for elements.
.element { box-sizing: border-box; }
column-count
,column-gap
,column-rule
- Enables multi-column layouts.
- Use case: Displaying content in newspaper-like columns.
.text { column-count: 3; column-gap: 20px; }
min-content
,max-content
- Controls the minimum and maximum size of an element based on its content.
- Use case: Auto-adjusting size based on content length.
.element { width: min-content; }
2. Visual & Aesthetic Properties
border-radius
- Rounds the corners of an element.
- Use case: Creating buttons or containers with rounded corners.
.box { border-radius: 10px; }
box-shadow
- Adds a shadow effect to an element.
- Use case: Applying shadows to cards, buttons, or containers.
.box { box-shadow: 2px 2px 10px rgba(0,0,0,0.5); }
background-size
- Specifies the size of background images.
- Use case: Creating full-width or responsive background images.
.container { background-image: url('image.jpg'); background-size: cover; }
background-clip
- Specifies whether the background extends beneath the border, padding, or content.
- Use case: Controlling the background’s clipping behavior.
.box { background-clip: content-box; }
opacity
- Controls the transparency level of an element.
- Use case: Making an element semi-transparent.
.overlay { opacity: 0.8; }
text-shadow
- Adds shadow effects to text.
- Use case: Applying decorative shadows to headings or text.
h1 { text-shadow: 2px 2px 5px gray; }
filter
- Applies graphical effects like blur, brightness, or grayscale to an element.
- Use case: Applying image effects or blurring backgrounds.
.image { filter: grayscale(100%); }
3. Animation & Transition Properties
transition
- Smoothly transitions between CSS property changes.
- Use case: Adding hover effects for buttons or links.
.button { transition: background-color 0.3s ease; }
animation
- Defines keyframe-based animations for elements.
- Use case: Creating animated loading spinners, image sliders, or notifications.
@keyframes example { from { opacity: 0; } to { opacity: 1; } } .element { animation: example 2s ease-in-out infinite; }
transform
- Transforms elements by scaling, rotating, skewing, or translating them.
- Use case: Rotating images, scaling elements, or creating 3D effects.
.rotate { transform: rotate(45deg); }
perspective
- Adds depth to 3D-transformed elements by specifying a perspective distance.
- Use case: Creating 3D card flips or rotating objects in 3D space.
.container { perspective: 1000px; }
4. Typographic & Text Properties
font-feature-settings
- Controls advanced typographic features in OpenType fonts.
- Use case: Enabling ligatures or old-style numerals in fonts.
.text { font-feature-settings: "liga"; }
word-wrap
,overflow-wrap
- Allows long words to break and wrap to the next line.
- Use case: Preventing text overflow in narrow containers.
.paragraph { word-wrap: break-word; }
text-overflow
- Defines how overflowed text is displayed (e.g., with ellipsis).
- Use case: Truncating long text with “…” in a single-line container.
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
5. Responsive Design Properties
media queries
- Applies styles based on screen width or device characteristics.
- Use case: Responsive design for different screen sizes (mobile, tablet, desktop).
@media (max-width: 600px) { .container { width: 100%; } }
viewport units
(vw
,vh
)- Specifies sizes based on the viewport width or height.
- Use case: Creating responsive elements that adjust based on the viewport.
.full-width { width: 100vw; }
calc()
- Performs calculations to set property values dynamically.
- Use case: Creating layouts with mixed units or dynamic sizing.
.box { width: calc(100% - 50px); }
6. Miscellaneous New Properties
pointer-events
- Specifies whether or not an element reacts to pointer events like clicks.
- Use case: Disabling interaction with certain elements.
.disabled { pointer-events: none; }
resize
- Allows users to resize an element (such as a textarea).
- Use case: Letting users manually resize elements on the page.
.resizable { resize: both; overflow: auto; }
object-fit
- Specifies how media (e.g., images or videos) should be resized to fit their container.
- Use case: Keeping images proportional in containers of different sizes.
.image { object-fit: cover; }
writing-mode
- Defines whether lines of text are laid out horizontally or vertically.
- Use case: Displaying text in vertical languages like Japanese or for special design layouts.
.vertical-text { writing-mode: vertical-rl; }
Conclusion
CSS3 introduced a wide array of properties that improve layout design, typography, animations, and interactivity, making web development more powerful and flexible. These properties allow developers to create responsive, visually appealing, and interactive web pages, with improved control over styling and design.