CSS (Cascading Style Sheets) is the major technology for web developers which allows them to convert basic HTML documents into visually appealing and dynamic web pages. CSS techniques change along with the web.
In this article, we will look at ten modern CSS techniques that will take your website designs to the next level. We will discuss 10 modern CSS tricks and techniques that will turn your simple website design into a more modern and visually appealing websites.
1. CSS grid layout
CSS grid layout is a two-dimensional system that allows to create of complex and flexible layouts. It enables you to arrange content in columns and rows.
For example: Let’s create a grid system with three columns and two rows.
.grid-container { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: 100px 200px; }
2. CSS Flexbox
For flexible and dynamic layouts, Flexbox is ideal. It is quite good at arranging things inside containers. It gives you a better way to organize, align, and divide up the available space among the container’s contents. It primarily functions to allow CSS3 to adjust an item’s width and height to best match all available places.
for example: A horizontally centered layout
.container { display: flex; justify-content: center; }
3. CSS Custom Properties (Variables)
we can store and reuse values across our stylesheets by using custom properties. This makes it easier to keep track of pre-defined styles and apply them as needed. You may easily add adjustments using CSS custom properties.
:root { --main-color: #007bff; } .button { background-color: var(--main-color); }
4. CSS Transitions
Using CSS transitions, you may gradually modify the value of a property over a specified time.
5. CSS Media Queries
A CSS property called media query is used to make responsive web pages. It modifies the website’s content to fit the screen size. Media queries facilitate the development of responsive websites.
@media (min-width: 600px) and (max-width: 800px) { body { background-image: url('https://img.freepik.com/free-photo/beautiful-view-greenery-bridge-forest-perfect-background_181624-17827.jpg?w=2000') } H1{ color:white; } }
If you want to learn more about media queries then you can go through our article “mastering media queries”
6. CSS Filters
Image filters in CSS are a collection of properties that allow you to change the appearance of an image.
Some common filter effects are:
a)Grayscale: Converts an image to shades of grey, removing color.
b)Blur: Blurs the image, providing a blurry or softened impression.
c)Brightness: Adjusts the overall brightness of the image.
.image { filter: blur(5px); }
7. CSS Gradient
The gradient is a property that enables seamless transitions between two or more defined colors.
Gradients in CSS are classified into two types:
- Linear Gradient:
body{ background-image: linear-gradient(Red,yellow); }
- Radial Gradient:
body { background-image: radial-gradient( olive, orange) }
8. Text-Transform
The CSS property text-transform is used to alter the style of the text on a webpage. Text can be changed to upper case, lower case, capitalized, etc. using the text-transform property.
.uppercase { text-transform: uppercase; } .lowercase { text-transform: lowercase; }
9. Curve Text Around floating Image
A CSS feature called shape-outside enables geometric shapes to be defined in order to define an area for text to flow around.
.circle { width: 400px; float: right; shape-outside: circle(50%); }
ADVERTISEMENT
10. CSS Blend Modes
A CSS property called blend-mode describes how the background colors and pictures of an element should merge into one another.
ADVERTISEMENT
image{ blend-mode: <value>; /* or */ mix-blend-mode:<value>; }
ADVERTISEMENT
Now We have Successfully provided you with “10 Most Advanced CSS Tricks and Techniques,” which may be used to bring additional visual appeal to your website. We hope you understood the project. If you have any doubts, feel free to comment!
ADVERTISEMENT
If you find out this Blog helpful, then make sure to search Codewithrandom on Google for Front End Projects with Source codes and make sure to Follow the Code with Random Instagram page.
ADVERTISEMENT
Follow: CodewithRandom
Author: Arun