CSS, or Cascading Style Sheets, is an essential tool for web developers and designers alike. With CSS, you can control the layout, typography, and appearance of your web pages. While many developers are familiar with popular CSS properties like font-size and margin, there are many other lesser-known CSS properties that can help you create even more beautiful and functional web designs.
In this blog post, we will take a closer look at six CSS properties that you probably didn't know about.
1. text-underline-offset
The text-underline-offset property allows you to control the distance between an underlined text and the text itself. This can be useful for making your underlines stand out more or creating unique text effects. The value of this property is a length, which can be positive or negative, depending on how you want to adjust the offset.
h1 {
text-decoration: underline;
text-underline-offset: 5px;
}
2. text-justify
The text-justify property allows you to control how text is aligned and spaced within a block of text. This can be especially useful for creating newspaper-style columns or for formatting text within a justified block. The value of this property can be set to auto, inter-word, inter-character, or distribute.
p {
text-align: justify;
text-justify: inter-word;
}
3. backdrop-filter
The backdrop-filter property allows you to apply a visual effect to the area behind an element. This can be useful for creating blur or grayscale effects on images or other elements. The value of this property can be set to blur, grayscale, sepia, or any other CSS filter function.
div {
backdrop-filter: blur(5px);
}
4. column-rule
The column-rule property allows you to add a vertical rule between columns of text in a multi-column layout. This can be useful for creating a visual separation between different sections of a page or for adding a decorative element to your design. The value of this property is a border style and color.
div {
column-count: 3;
column-rule: 1px solid black;
}
5. text-orientation
The text-orientation property allows you to control the orientation of text within a block element. This can be useful for creating vertical text layouts or for formatting text in languages that are read vertically, such as Japanese. The value of this property can be set to mixed, upright, or sideways.
div {
writing-mode: vertical-rl;
text-orientation: upright;
}
6. shape-outside
The shape-outside property allows you to wrap text around a non-rectangular shape, such as a circle or polygon. This can be useful for creating visually interesting text layouts or for aligning text with irregularly shaped images or elements. The value of this property is a shape function or image.
img {
float: left;
shape-outside: circle();
width: 200px;
height: 200px;
margin: 20px;
}
In conclusion, these six CSS properties are just a few of the many ways that you can use CSS to create beautiful and functional web designs. By exploring lesser-known CSS properties, you can unlock new creative possibilities and take your web designs to the next level.
Top comments (2)
I just used one of these amazing css propeties, thanks for this article.
No Problem