Tag: background-image

Clear, practical tips on using CSS background images — positioning, sizing, layering, and common patterns, explained simply.

  • Simple Ways to Create a CSS Overlay Effect

    Simple Ways to Create a CSS Overlay Effect

    Have you ever wanted to add cool effects to your website? With the CSS overlay effect, you can easily create stylish overlays to make your content stand out! Let’s see how it works!

    What are overlay effects?

    A CSS overlay effect is a powerful technique for placing an extra layer on top of your web content, typically an image or a background, to enhance its appearance or improve readability.

    This effect allows you to create various visual enhancements, such as darkening an image or adding a color tint.

    You can achieve overlays using the CSS background-color and background-image properties, enabling you to apply stunning visual effects to images. With these properties, you can easily modify the look and feel of your content, making it more engaging and visually appealing.

    Let’s dive into an example to see how the CSS overlay effect works.

    Basic HTML and CSS setup for a CSS overlay effect

    First, we need to create an HTML element to hold our image and assign it a class. This class will contain all the necessary CSS rules to achieve the desired overlay effect.

    <div class="overlay-container"></div>
    HTML

    Next, we write the CSS for our class, setting a background image without repetition. This ensures the image fits nicely within a 400x600px box. With this setup, we can easily apply overlay effects or make further adjustments as needed.

    .overlay-container {
      width: 400px;
      height: 600px;
    
      background-image: url('your-image-url-here');
      background-repeat: no-repeat;
      background-size: cover;
    }
    CSS

    At this stage, this is how our image appears on the screen.

    Using pseudo-elements for the CSS overlay effect

    A common technique for creating overlay effects is pseudoelements (:before and :after). To get this effect working, we have to prepare our class by setting position: relative. Then, we apply position: absolute to the :before pseudo-element. This ensures that :before is positioned relative to its parent — the overlay container.

    We also use the content: "" declaration to make sure the pseudo-element is generated. In this case, the content remains empty since we want the image to be visible underneath.

    Additionally, we set width: 100%; and height: 100%; to ensure the :before pseudo-element covers the entire area of its parent container, completely overlaying the image.

    .overlay-container {
      ...
      position: relative;
    }
    
    .overlay-container:before {
      position: absolute;
      content: "";
      width: 100%;
      height: 100%;
    }
    CSS

    🔖 For the time being, nothing has changed on our screen; we just made the appropriate preparations for our effect. Let’s continue.

    Applying the CSS overlay effect

    Overlay effects come in various types, each adding a unique touch to our images. The CSS property that helps us to create this effect is background-image.

    Below, I’ve created different variations for you to explore. 👩‍💻 Enjoy!

    Using a linear gradient for the overlay effect

    In the following CSS code snippet, you can see that the background-image property is set to linear gradient(...), creating a multi-color overlay effect with different transparency levels. This produces a smooth gradient overlay from top to bottom with shades of teal, yellow, and purple that make the perfect match for our image.

    .overlay-container:before {
      ...
      background-image: linear-gradient(
        rgba(0, 255, 255, 0.3),
        rgba(255, 255, 0, 0.2),
        rgba(155, 0, 155, 0.2)
      );
    }
    CSS

    Using a radial gradient for the overlay effect

    We continue with a more creative approach. Here, radial gradient(...) creates a unique overlay effect using a circular pattern. It transitions from shades of light gray to dark gray, adding a subtle yet eye-catching touch to the image.

    .overlay-container:before {
      ...
      background-image: radial-gradient(
        rgba(255, 255, 255, 0.1),
        rgba(128, 128, 128, 0.2),
        rgba(0, 0, 0, 0.6)
      );
    }
    CSS

    Creating a rainbow CSS overlay effect

    Another vibrant and playful effect is the rainbow gradient. Often used for decorative purposes, this effect adds bright, joyful colors to the image, creating a fun and lively vibe. 🌈✨

    When you apply this gradient as a background, it creates a smooth transition of colors from purple to red, mimicking the colors of a rainbow (ROYGBIV). The use of semi-transparent alpha values gives a soft blending effect between the colors, creating a visually appealing and harmonious overlay.

    .overlay-container:before {
      ...
      background-image: linear-gradient(to bottom left,
        rgba(148, 0, 211, 0.5), rgba(75, 0, 130, 0.3),
        rgba(0, 0, 255, 0.2), rgba(0, 255, 0, 0.2),
        rgba(255, 255, 0, 0.3), rgba(255, 127, 0, 0.3),
        rgba(255, 0, 0, 0.3)
      );
    }
    CSS

    In this example, I changed my image to make the outcome clearer, adding a colorful vibe to create a playful atmosphere.

    Adding a solid color CSS overlay effect

    You are always free to use a single color as an overlay. In that case, we will apply the background-color CSS property to the :before pseudo-element.

    .overlay-container:before {
      ...
      background-color: rgba(220, 135, 135, 0.2); /* pale pink */
    }
    CSS

    In this example, I kept the second image to make the outcome clearer. I’ve given it a softer, more romantic feel, where the pale pink color with the slight see-through effect adds a charming and gentle mood.

    🌼 Hope you found my post interesting and helpful.
    Thanks for being here! 🌼

  • CSS Grayscale Filter – A Complete Guide

    CSS Grayscale Filter – A Complete Guide

    Hello everybody! 😃 In the vibrant world of web design, the CSS grayscale filter stands as a powerful tool for transforming the visual appearance of images and elements on a webpage. The CSS filter: grayscale(%) works like a magic wand. 🪄 It takes colorful images or elements and converts them into grayscale shades. This effect is great for creating different aesthetics, whether you’re aiming for a vintage charm or a sleek, modern look. The CSS grayscale filter can be applied to various elements, including images, SVGs, emojis, font icons, and even HTML elements.

    Let’s explore what makes this filter so enchanting! 🧙‍♀️

    Grayscale on HTML elements

    First of all, it’s important to note that the CSS grayscale filter may not be noticeable on black and white elements. Since grayscale shifts colors toward shades of gray, and black is already the darkest shade, while white stays the lightest one. Secondly, always keep in mind that the filter: grayscale(100%) can make text completely dark, which may not be ideal when placed on black or very dark backgrounds.

    Using the CSS grayscale filter on fonts

    We will begin by applying grayscale to fonts. In the following example, I used blue text, instead of the default black to emphasize the contrast and make the transition to shades of gray more noticeable.

    This reinforces an important point we discussed earlier—this effect stands out most when applied to bright, colored elements rather than dark, black, or near-black ones. 😉

    <h1>The grayscale filter</h1>
    HTML
    h1 {
      color: blue;
      filter: grayscale(50%);
    }
    CSS

    With the HTML code, we define an <h1> heading element, then CSS sets its text color to blue and applies a grayscale filter to it. Initially, we use 50% intensity, creating a visual effect where the blue text is converted to grayscale while still retaining a subtle hint of its original blue color.

    To clarify, there is another example where we use the filter at 90%, resulting in the title appearing in different shades of gray. This time, it’s very close to being completely dark gray—almost black, we could say.

    This image shows a blue text.
    without grayscale(%)
    This image displays blue text with the CSS grayscale filter set to 50%, partially desaturating the blue color into varying shades of gray.
    with grayscale(50%)
    This image displays blue text with the CSS grayscale filter set to 90%, turning it into grayish shades while retaining 10% of the original blue color.
    with grayscale(90%)

    Grayscale on background color

    In this case, instead of setting the text color, we will set the background-color. Now, take a look at the orange. In the first image, we see a bright orange, while in the second, the color appears slightly darker (grayish) due to the filter: grayscale(40%) property.

    <h1>The grayscale filter</h1>
    HTML
    h1 {
      background-color: orange;
      filter: grayscale(40%);
    }
    CSS
    This image displays black text on an orange background color.
    without grayscale(%)
    This image displays black text on an orange background with the CSS grayscale filter set to 50%, converting the background into grayish shades while reducing its original color intensity.
    with grayscale(40%)

    Grayscale on other HTML elements

    We can also apply the grayscale filter to various HTML elements, such as <span>, <li>, and more. Below, I’ve provided two examples for clarity: the first applies the filter to the content of two <span> elements, while the second applies it to the bullets of an <li>.

    Example using a span

    <div class="grayscale-elements">
      <span>"</span> Happy Coding! <span>"</span>
    </div>
    HTML
    .grayscale-elements {
      color: orange;
    }
    
    .grayscale-elements span {
      filter: grayscale(80%);
    }
    CSS

    In the HTML snippet, we create a <div> element with the class .grayscale-elements. Inside this <div>, we add two <span> elements, each containing a double quote to frame the text “Happy Coding!” These <span> elements allow us to style the quotes differently from the rest of the text.

    In the associated CSS code, .grayscale-elements is targeting elements with this class. The text color of the elements with this class is set to orange. Additionally, the CSS rules target the <span> elements inside and apply an 80% grayscale filter to them, rendering the quotes in shades of gray while retaining the orange color for the rest of the content.

    This image displays orange text enclosed in quotation marks.
    without grayscale(%)
    This image displays orange text enclosed in quotes, with the quotes inside <span> elements. The spans have the CSS grayscale filter set to 80%, converting the orange color into grayish shades while retaining 20% of its original hue.
    with grayscale(80%)

    Example using a ul

    <ul>
      <li>HTML</li>
      <li>CSS</li>
      <li>Javascript</li>
    </ul>
    HTML
    ul {
      list-style: none; /* remove the default bullets */
    }
    
    li {
      color: magenta; /* change lists default (black) color */
    }
    
    li:before {
      content: "•"; /* add new bullets and now can be manipulatated */
      margin-right: 10px; /* add distance between the bullet and the text */
      filter: grayscale(50%); /* one of our examples */
    }
    
    CSS

    In the HTML snippet, we create an unordered list (<ul>) containing three list items (<li>).

    In the associated CSS, we target the <ul> element and remove the default bullets using list-style: none. Then, we style the list items (<li>), setting their text color to magenta.

    The :before pseudo-element is used to add custom bullets before each list item. In this case, the bullet is a solid circle (•) created using the content property. The margin-right property adds spacing between the bullet and the text.

    Additionally, a grayscale effect is applied to the bullets using filter: grayscale(50%), reducing their original color intensity by 50%. This results in bullets appearing in varying shades of gray while still retaining some color.

    For an even more pronounced effect, I also applied a 90% grayscale filter (filter: grayscale(90%)), making the bullets appear even closer to a true gray. 😃

    This image displays an unordered list with three list items, all styled in magenta color.
    without grayscale(%)
    This image shows an unordered list with three list items inside. The list items have color magenta while a grayscale effect is applied to the bullets using filter: grayscale(50%), rendering them with a 50% intensity of grayscale.
    with grayscale(50%)
    This image displays an unordered list with three magenta-colored list items. The bullets have the CSS grayscale filter set to 90%, making them appear in grayish shades.
    with grayscale(90%)

    CSS Grayscale on images

    Another way to take advantage of this CSS property is by applying the filter: grayscale to images, transforming their colors into shades of gray. This is particularly useful for making pictures look old-fashioned or monochromatic when they create a black and white effect.

    <div class="grayscale-image"><div>
    HTML
    .grayscale-image {
      background-image: url(<your-image>);
      background-repeat: no-repeat;
      background-size: cover;
      width: 300px;
      height: 400px;
      filter: grayscale(70%);
    }
    CSS

    The given code creates an HTML div element with the class .grayscale-image.

    This class is styled using CSS to display a grayscale image. The background of the div is set to an image from the provided URL using the background-image property. The image is styled to not repeat (background-repeat: no-repeat) and to cover the entire area (background-size: cover). Its dimensions are set to width of 300 pixels and height of 400 pixels. Finally, a grayscale filter is applied to the image using the filter property, with a 70% level of grayscale.

    This image displays a photo with vibrant colors, including shades of pink, gold, and green.
    without grayscale(%) – Original photo by Katie Harp on Unsplash
    This image displays a photo with colors close to pink, gold, and green, with the CSS grayscale filter set to 70%, partially desaturating the colors into grayish tones.
    with grayscale(70%)

    I did something similar for the following image but set the grayscale to 100%, which transformed the image entirely into shades of gray. Impressive, isn’t it? 🙃

    This image displays a photo of a brown building with the sky in the background and an airplane flying overhead.
    without grayscale – Original photo by Sorasak on Unsplash
    This image displays a photo of a brown building and the sky with an airplane. The CSS grayscale filter is set to 100%, converting the entire photo into grayscale shades.
    grayscale(100%)

    CSS Grayscale on SVG

    The grayscale filter can be applied to SVG elements too, making them appear in varying shades of gray. This is often used to achieve a specific artistic or design effect. For instance, we applied this filter to an SVG of a moon, which was originally yellow, transforming it into a soft gray and adding a unique visual dimension. Awesome, right?

    svg {
      filter: grayscale(80%);
    }
    CSS

    In our CSS code, we apply a filter with a specified grayscale percentage of 80%. This effect transforms the originally yellow image into varying shades of gray while preserving a subtle hint of its original color.

    🔖 Remember that directly targeting the <svg> element may cause conflicts 🌩 ⚡ if multiple SVGs exist in the document.

    This image displays a yellow moon against a dark background.
    without grayscale(%)
    This image displays a yellow moon with the CSS grayscale filter set to 80%, partially desaturating the colors into grayish shades while retaining 20% of the original hue.
    with grayscale(80%)

    CSS Grayscale in Font Awesome

    Another way to use this CSS trick is with Font Awesome icons. In the example below, we will see how to do it the correct way. Since Font Awesome icons start off as black, it’s important to apply color before adding the grayscale effect.

    <i class="fa-solid fa-camera-retro"></i>
    
    HTML
    .fa-camera-retro {
      color: red;
      filter: grayscale(70%);
    }
    
    /* OR - if you want a more generic rule */
    
    i {
      color: red;
      filter: grayscale(70%);
    }
    CSS

    In this HTM snippet, we have an <i> element with the class .fa-solid .fa-camera-retro from the Font Awesome library.

    The corresponding CSS styles .fa-camera-retro, setting the icon’s color to red and applying a 70% grayscale effect. Additionally, we can also target the <i> element directly for a more generic customization.

    🔖 Remember, if you use the Font Awesome .fa-solid class for multiple icons or style them via <i>, all instances will inherit the same appearance, affecting every <i> element in the document.

    This image displays a red retro camera icon from Font Awesome.
    without grayscale
    This image displays a red retro camera icon from Font Awesome with the CSS grayscale filter set to 70%, making the red appear much darker, almost brown.
    with grayscale(70%)

    CSS Grayscale on emoticons using pseudo-elements

    Next, we move on to the beloved emoticons (like 🤗, 😇, etc.). It’s a cool way to make them look a bit different! Below I crafted an example to give a clearer explanation. I chose two of my favorite emoticons 👩‍🎤 🧚‍♀️. Feel free to choose your personal favorite and enjoy the experience!! Always remember that the more vivid the colors, the stronger and more noticeable the effect will be! Good luck! 🌟 🥳

    <div class="grayscale-emoticons"></div>
    HTML
    .grayscale-emoticons:before {
      content: "👩‍🎤 🧚‍♀️";
      filter: grayscale(40%);
      font-size: '50px';
    }
    CSS

    The HTML snippet creates a div element with the class .grayscale-emoticons.

    The linked CSS code, .grayscale-emoticons uses the :before pseudo-element to insert content. The inserted content consists of two emojis: “👩‍🎤” and “🧚‍♀️.” Additionally, a grayscale filter of 40% is applied, giving the emojis a subtle grayscale effect, displaying them in varying shades of gray while retaining some of their original colors.

    I also included another example with a 100% grayscale filter, which completely removes all colors, rendering the emojis entirely in grayscale.

    This image shows two colorful emoticons.
    without grayscale
    This image shows two colorful emoticons with a grayscale filter of 40%. As a result the emoticons are now displayed in varying shades of gray with 40% intensity of the original colors.
    with grayscale(40%)
    This image shows two colorful emoticons with a grayscale filter of 100%. As a result the emoticons are now displayed only in shades of gray.
    with grayscale(100%)

    Using shades of gray adds a nice touch, but if you want to go the extra mile 🏃‍♀️, try adding shadows to elements for a more realistic look. Building on our previous example, I’ve incorporated the fantastic drop-shadow CSS property to achieve this. Pretty cool, right! 😃

    .grayscale-emoticons:before {
      content: "👩‍🎤 🧚‍♀️";
      filter: grayscale(40%) drop-shadow(2px -1px 1px #1d1e22);
      font-size: 100px;
    }
    CSS
    This image displays two colorful emoticons with the CSS grayscale filter set to 40%, partially desaturating their colors. They also feature a 2px -1px 1px gray shadow.
    filter: grayscale(40%) drop-shadow(2px -1px 1px #1d1e22);
    This image shows two colorful emoticons with a grayscale filter of 100%. As a result the emoticons are now displayed in various shades of gray. They also have a 2px -2px 2px gray shadow.
    filter: grayscale(100%) drop-shadow(2px -2px 2px #1d1e22);

  • CSS Conic Gradient Made Easy

    CSS Conic Gradient Made Easy

    Hello! 😃 CSS conic gradient techniques are a fantastic way to add colorful, creative flair to your designs. Today, we’re diving into the enchanting world of conic-gradient in CSS — a type of gradient where colors transition in a circular or conical pattern around a central point (either the default center or one you define within the element).

    This powerful technique allows you to blend and combine colors in unique ways, creating artistic and visually striking effects. Plus, it’s perfect for building things like pie charts for presentations — no extra libraries needed!

    In addition to conic-gradient CSS also offers linear-gradient and radial-gradient techniques. 🌈✨ They all have a starting and an ending point, giving us the flexibility to control the direction and flow of the gradient. It is essential to blend at least two colors, but we can blend even more, creating smooth transitions or distinct shifts between them based on our needs.

    Ready to unlock 🗝 the art and practical uses of conical gradients? Let’s jump into this creative adventure! 💻

    What is a conic gradient?

    A CSS conic gradient is a styling technique used in CSS to create a color transition that radiates from a central point in a circular or conical pattern. It allows you to specify different color stops and angles, leading to a visually pleasing gradient effect for backgrounds or other elements on a webpage.

    There are many variations and creative ways to use conic gradients — and we’ll be exploring them in the next sections!

    Understanding the default direction of a CSS conic gradient

    So, let’s begin with the default direction, which is clockwise. To create a conic gradient, we need at least two colors. Below, I’ve prepared some examples to show exactly what I mean.

    /* blend two colors */
    
    .conic-two-colors {
      background-image: conic-gradient(red, green);
    }
    
    CSS
    Default CSS conic gradient with two colors, red and green
    /* blend many colors */
    
    .conic-multiple-colors {
      background-image: conic-gradient(red, green, blue, magenta, yellow, purple, orange);
    }
    
    CSS
    Default conic gradient with many colors.
    /* blend black and white */
    
    .conic-black-white {
      background-image: conic-gradient(black, white);
    }
    
    CSS
    Default conic gradient with only black and white.

    🔖 Keep in mind that if we want to achieve a seamless transition between the last and first color, we have two ways to achieve this:

    • First, we can choose intermediate colors between the starting and ending colors. For example, in our case, we can pick colors from #FF4C00 (orange) to #FF6E00 (a reddish shade), creating a smooth blend from orange to red.
    • The second option, which is simpler, involves repeating the same color at both ends. In this example, we’ll use red as the repeated color.

    Here’s a simple code snippet to help illustrate this.

    /* using specific colors when blending */
    .conic-smooth-option-a {
      background-image: conic-gradient(red, green, blue, magenta, yellow, purple, orange, #FF4C00, #FF6E00);
    }
    
    /* using the same color at both ends */
    .conic-smooth-option-b {
      background-image: conic-gradient(red, green, blue, magenta, yellow, purple, orange, red);
    }
    
    CSS

    Positioning the center of a CSS conic gradient

    Move the center to the sides

    In CSS, conic gradients provide the flexibility to reposition the gradient’s center anywhere within the container. This enables precise alignment with a specific side, whether or not you use percentage values (%) or define specific color stops.

    In the following examples, we’ll focus on positioning the gradient center along different sides of the container.

    /* Gradient starting from the left */
    
    .conic-left-point {
      background-image: conic-gradient(at left, red, green, blue, purple, orange);
    }
    
    CSS
    Conic gradient with many colors. The center is at the left side of the square.
    /* Starting point at 75% from the left */
    
    .conic-using-percentage {
      background-image: conic-gradient(at left 75%, red, green, blue, purple, orange);
    }
    
    CSS
    Conic gradient with many colors. The center is at the 75% of the left side of the square.
    /* Gradient starting at 75% left with defined color stops */
    
    .conic-specific-stops {
      background-image: conic-gradient(at left 75%, red 5%, green 10%, blue 15%, purple 20%, orange 25%);
    }
    
    CSS
    Conic gradient with many colors and specific color stops. The center is at the 75% of the left side of the square.

    Move the center to the corners

    Building on the previous section, we can also move the gradient’s center to the corners of the container. Conic gradients in CSS allow this kind of precise positioning, with or without using color stops, giving you even more layout control.

    Without color stops

    The following code snippet shows a gradient that starts from the center point of our element with red color, transitions to green, then blue, followed by purple, ending with orange, creating a smooth, circular gradient effect.

    .conic-default {
      background-image: conic-gradient(red, green, blue, purple, orange);
    }
    CSS

    Below we can see how the previous gradient can break into different pieces the position we choose for the gradient’s center.

    The CSS code snippet .conic-corner-bottom-right starts at the bottom right corner of our element and smoothly transitions through red, green, blue, purple, and orange creating a visually appealing color blend.

    .conic-bottom-right-corner {
      background-image: conic-gradient(at bottom right, red, green, blue, purple, orange);
    }
    CSS
    CSS Conic-gradient where the center is at the bottom right corner.

    The reason you’re only seeing the purple and orange colors is due to the angle of the gradient in relation to the element.

    I followed the same steps with .conic-bottom-left-corner, and as the angle changes, the red and green colors become visible. The same goes for .conic-top-right-corner, where we can now see shades of blue and purple. Finally, by setting the center to the top left using .conic-top-left-corner, green and blue come into view. How cool is that! 🥳

    .conic-bottom-left-corner {
      background-image: conic-gradient(at bottom left, red, green, blue, purple, orange);
    }
    CSS
    CSS Conic-gradient where the center is at the bottom left corner.
    .conic-top-right-corner {
      background-image: conic-gradient(at top right, red, green, blue, purple, orange);
    }
    CSS
    Conic-gradient where the center is at the top right corner.
    .conic-top-left-corner {
      background-image: conic-gradient(at top left, red, green, blue, purple, orange);
    }
    CSS
    Conic-gradient where the center is at the top left corner.

    Imagine that changing the center position and adjusting the angle is like zooming in on the gradient — revealing each quarter of the circle more closely, one at a time. 🔍 It’s like examining the gradient through a magnifying glass as you explore each corner!

    With color stops

    Let’s take a look at the following example, where color stops are used to better control how and where each color appears within the conic gradient.

    Color stops let you define specific points along the gradient circle where a color should begin or end. This gives you greater precision over the flow of colors, rather than relying on an even, automatic blend. For example:

    .conic-color-stops {
      background-image: conic-gradient(red 75%, green 80%, blue 90%, purple 95%, orange 100%);
    }
    CSS
    CSS conic-gradient with color stops — red to 75%, then green, blue, purple, and orange up to 100%, creating sharp transitions in a circular layout.

    In this case, red takes up the majority of the gradient — up to 75% — and the remaining colors (green, blue, purple, and orange) appear in quicker succession toward the end.

    We can also combine color stops with center positioning to control not only when colors appear but also where they start. For instance:

    .conic-bottom-right-stops {
      background-image: conic-gradient(at bottom right, red 75%, green 80%, blue 90%, purple 95%, orange 100%);
    }
    CSS
    Conic-gradient with many colors and specific color stops. The center is at the bottom right corner.
    .conic-bottom-left-stops {
      background-image: conic-gradient(at bottom left, red 75%, green 80%, blue 90%, purple 95%, orange 100%);
    }
    CSS
    Conic-gradient with many colors and specific color stops. The center is at the bottom left corner.

    These examples show how positioning the gradient center at different corners—while using color stops—can dramatically affect which parts of the gradient are visible. You’ll notice that the dominant red still takes the lead, but the visibility of the other colors shifts depending on the corner you choose.

    Moving the center inside the element

    We continue with a really powerful feature of conic gradients: the ability to position the center anywhere inside the element. This opens up even more creative possibilities — and of course, you’re free to use color stops with these custom center positions as well.

    Below, I’ve prepared two examples.

    In the first one, the gradient starts from a point located 30% across and 55% down the element. It then smoothly transitions through different colors: red, green, purple, magenta, yellow, and orange. Imagine a color wheel starting from red and going around in order, stopping at each of these colors along the way.

    .conic-center-30-55 {
      background-image: conic-gradient(at 30% 55%, 
      red, green, purple, magenta, yellow, orange);
    }
    CSS
    Conic-gradient with many colors where the center is at 30% across and 55% down.

    In the second one, the gradient starts from a point 30% across and 55% down the element — but this time, it uses color stops to control exactly where each color appears.

    Then it transitions through different color stops: red 15%, green 30%, purple 45%, magenta 60%, yellow 90%, and finally orange at 100%. You can use my example or you are free to create your own. I chose these values based on what felt right to me—but feel free to experiment and create your own version. It’s totally up to you

    .conic-center-30-55-stops {
      background-image: conic-gradient(at 30% 55%, 
      red 15%, green 30%, purple 45%, magenta 60%, yellow 90%, orange 100%);
    }
    CSS
    Conic-gradient with many colors and specific color stops. The center is at 30% across and 55% down.

    Changing the starting angle of a CSS conic gradient

    Let’s move forward and explore another option we have another option available with conic gradients, as we are free to start the gradient from different points.

    In our example the gradient starts at 45 degrees to the right, moving from red to blue. This means the colors change smoothly in a circular motion, like a slice of pie with red at the starting edge and blue at the finishing point.

    .conic-angle-45 {
      background-image: conic-gradient(from 45deg, red, blue);
    }
    CSS

    CSS conic gradient without blending

    Another option is to use a non-blend gradient technique. In the following code snippet, the gradient starts with the color red at the top of the circle and makes sharp, sudden transitions to the next colors — green, blue, purple, and finally orange. Each color occupies a distinct 20% slice of the circle, creating a step-like, segmented pattern with no smooth blending between sections. It’s like a colorful pie chart made of equal parts..

    .conic-no-blending {
      background-image: conic-gradient(
      red 0%, red 20%, 
      green 20%, green 40%, 
      blue 40%, blue 60%, 
      purple 60%, purple 80%, 
      orange 60%, orange 100%
      );
    }
    CSS

    Creating repeating CSS conic gradients

    The repeating-conic-gradient is a function that is used to repeat the conic gradient. Below are two examples that show just how flexible and creative conic gradients can be.

    1. Repeating every 10%: The gradient originates from the center of the element. It begins with red at the center, then transitions to green at 5%, and to blue shortly after. At 10%, it shifts to a specific pinkish-red color defined by the hex code #ff1064. These color transitions repeat every 10% of the circle, creating a series of concentric slices that cycle outward in a continuous, colorful loop.

    .conic-repeat-10 {
      background-image: repeating-conic-gradient(red, green 5%, blue 5%, #ff1064 10%);
    }
    CSS

    2. Repeating every 25%: In this example, the gradient is centered within the element and begins with green at the starting point. As it radiates outward, it shifts to black at 8%, then to orange at 18%, and finally to a vibrant pinkish-red at 25% (using the hex code #ff1064). These defined color stops repeat every 25% of the circle, creating a looping, segmented pattern that spirals out from the center in consistent, colorful sections.

    .conic-repeat-25 {
      background-image: repeating-conic-gradient(green, black 8%, orange 18%, #ff1064 25%)
    }
    CSS

    What to avoid when creating CSS conic gradients

    Always bear in mind that, to create a harmonious and uniform repeating conic gradient, it’s important to maintain consistent spacing and carefully planned distances between color stops.

    In the image below, we can observe that green, black, and orange are each repeated three times, while the color #ff1064 (a shade of pinkish-red) appears only twice. This happens because the total space occupied by all the defined color stops—green, black, orange, and #ff1064—adds up to 40% of the conic gradient.

    This setup ensures that the entire pattern repeats in a balanced way: the specified colors take up 40% of the gradient, and the remaining 60% of the circle is evenly distributed across the repeated pattern. The result is a visually pleasing and consistent circular repetition.

    The following code snippet defines the color stops and their positions for this repeating conic gradient:

    .conic-avoid-repeating {
      background-image: repeating-conic-gradient(green, black 8%, orange 18%, #ff1064 40%);
    }
    CSS

    Here’s what each part means:

    • green: This is the starting color of the gradient. It begins right at the 0% mark.
    • black 8%: The next color in the gradient is black, and it starts at 8%.
    • orange 18%: Orange follows next, starting at 18% of the circle.
    • #ff1064 40%: Finally, the last color in the gradient is a shade of pinkish-red specified by the hexadecimal color code #ff1064, and it starts at 40% of the circle’s circumference.

    After that, the pattern repeats, starting again from green and continuing through the same sequence.

    Creating amazing pie charts with CSS conic gradient

    The CSS conic function is used to create conic gradient backgrounds. A conic gradient creates a circular gradient, much like a pie chart, with or without different color stops defining different sections of the circle.

    And here’s the fun part: we’re completely free to shape our gradients into perfect circles using CSS! Just apply a border-radius of 50%, and you can create stunning pie-style visuals. 😃

    .pie-chart {
      background-image: conic-gradient(
      red 0%, red 12%, 
      orange 12%, orange 30%, 
      yellow 30%, yellow 48%, 
      green 48%, green 65%, 
      blue 65%, blue 82%, 
      purple 82%, purple 100%
      );
    }
    
    .circle {
      width: 240px;
      height: 240px;
      border-radius: 50%;
    }
    CSS

    Breakdown of the color segments:

    • red 0%, red 12% This pair defines a red segment that starts at 0% and ends at 12% of the circle. This represents the first segment of the conic gradient.
    • orange 12%, orange 30%: Starts right after red and continues to 30%, forming the orange slice.
    • yellow 30%, yellow 48%, green 48%, green 65%, and blue 65%, blue 82% each define their own slices.
    • The last segment, purple 82%, purple 100%, defines the purple segment that starts at 82% and goes all the way to 100% of the circle. This represents the last segment of the conic gradient.

    Each pair of color stops defines a slice of the CSS conic gradient, making it easy to visualize proportions — just like a pie chart!

  • CSS Linear Gradient Techniques: Create Colorful Line Drawings

    CSS Linear Gradient Techniques: Create Colorful Line Drawings

    Hey there! 😃 Exploring CSS linear gradient techniques is a fantastic approach to fashion vibrant, colorful mixtures. Gradients give us the flexibility to choose any desired direction, defined by their starting and ending points. Mixing a minimum of two colors is fundamental, yet the potential for blending expands further, enabling us to achieve seamless transitions or pronounced shifts based on our design requirements.

    Today, let’s dive into the exciting world of CSS linear gradient techniques. 🌈✨ Picture a smooth transition of colors in a straight line, adding a sleek and dynamic touch to your web design. With linear gradients, you can smoothly transition between colors. You have the power to guide the eye seamlessly from one color to another. Whether it’s a subtle shift or a striking contrast, mastering linear gradients empowers you to enhance the visual appeal of your web projects.

    Ready to discover 🔍 the art and versatility behind linear gradients? Let’s get started! 💻

    Definition of a radial gradient

    A linear gradient is a visual effect that allows us to smoothly shift between colors in a straight line inside any shape we want. It’s like blending multiple colors together in a straight line pattern, allowing us to create colorful and visually appealing backgrounds or effects for elements on our website.

    A linear gradient is a visual effect that allows us to smoothly shift between colors in a straight line inside any shape we want

    The default CSS linear gradient

    We will begin our exploration with the default linear gradient, characterized by its top-to-bottom direction. The following code snippet and image provide a clear representation.

    .linear-default {
      background-image: linear-gradient(red, green);
    }
    
    /* we are free to use "deg" too */
    .linear-default {
      background-image: linear-gradient(180deg, red, green);
    }
    CSS

    From side to side

    We can adjust the direction of our gradients whenever we need to. To help you understand this better, take a look at the example below, where we changed the default direction to to right.

    We are also free to choose any direction we want to top , to right , to bottom (the default direction), to left.

    .linear-to-top {
      background-image: linear-gradient(to right, red, green, blue);
    }
    CSS

    From corner to corner

    At any point, we also have the flexibility to alter the orientation of our gradients along the diagonal path. To illustrate this concept, consider the following example with the to bottom right direction.

    Here colors would spread from the top-left corner to the bottom-right corner. We can combine any corner with its adjacent sides, to top left, to top right, to bottom left, and to bottom right.

    .linear-to-corner {
      background-image: linear-gradient(to bottom right, red, green, blue);
    }
    CSS

    CSS Linear gradient using percentages %

    With less blend

    If we want to create a linear gradient with less blending (colors have more distinct limits this way) and maintain the same space for each color, we can use equal specific stops in the gradient by adding % percentages.

    .linear-less-blend {
      background-image: linear-gradient(
        red 0%, red 18%,
        green 22%, green 38%,
        blue 42%, blue 58%,
        purple 62%, purple 78%,
        orange 82%, orange 100%
      );
    }
    CSS

    🕵️‍♂️ In this example, I’ve divided the space into 5 segments, but I left a 4% blend among each space in order to create a smooth but small transition.

    The percentages between the color stops determine how smooth the transition between colors is.

    • Red (0% – 18%): defines a red color stop that starts at 0% and ends at 18% of the gradient.
    • Between 18% and 22%, there is no specific color stop defined. This gap represents a transition zone where the gradient transitions smoothly from red to green.
    • Green 22%, green 38%): defines a green color stop that starts at 22% and ends at 38% of the gradient.
    • Between 38% and 42%, there is no specific color stop defined. This gap represents a transition zone where the gradient transitions smoothly from green to blue.
    • Blue (42% – 58%): defines a blue color stop that starts at 42% and ends at 58% of the gradient.
    • Between 58% and 62%, there is no specific color stop defined. This gap represents a transition zone where the gradient transitions smoothly from blue to purple.
    • Purple (62% – 78%): defines a purple color stop that starts at 62% and ends at 78% of the gradient.
    • Between 78% and 82%, there is no specific color stop defined. This gap represents a transition zone where the gradient transitions smoothly from purple to orange.
    • Orange (82% – 100%): defines an orange color stop that starts at 82% and ends at 100% of the gradient.
    A colorful css linear gradient technique. Setting the background-image: linear-gradient( red 0%, red 18%, green 22%, green 38%, blue 42%, blue 58%, purple 62%, purple 78%, orange 82%, orange 100% );

    Without blend

    Finally, it is really useful to know that we are able to create non-smooth transitions. In the following example, we will see a gradient with distinct color stops at specific percentage intervals, resulting in a distinct color transition from red to orange. Each color stop abruptly changes to the next color at the defined percentage points.

    .linear-no-blend {
      background-image: linear-gradient(
        red 0%, red 20%, 
        green 20%, green 40%, 
        blue 40%, blue 60%, 
        purple 60%, purple 80%, 
        orange 80%, orange 100%
      );
    }
    CSS

    🕵️‍♂️ In this example, I’ve divided the space into 5 equal segments without blending among each other. So, we create multiple color stops without transitions.

    • Red (0% – 20%): defines a red color stop that starts at 0% and ends at 20% of the gradient.
    • Green (20% – 40%): defines a green color stop that starts at 20% and ends at 40% of the gradient.
    • Blue (40% – 60%): defines a blue color stop that starts at 40% and ends at 60% of the gradient.
    • Purple (60% – 80%): defines a purple color stop that starts at 60% and ends at 80% of the gradient.
    • Orange (80% – 100%): defines an orange color stop that starts at 80% and ends at 100%
  • CSS Rainbow Text: How To Make Astonishing And Vibrant Fonts

    CSS Rainbow Text: How To Make Astonishing And Vibrant Fonts

    Imagine infusing your web typography (fonts) with the vibrant hues of a dazzling 🌈✨ rainbow! Cascading Style Sheets (CSS) empower designers and developers to bring this captivating vision to life. A colorful font like the CSS rainbow effect is more than just a spectrum of colors; it’s a creative and dynamic way to enhance your website’s visual appeal and make a lasting impression on your visitors.

    Today, with this post, 😃 we’ll dive into the exciting world of creating a rainbow effect, unlocking the magic of colors and typography to elevate your web design. Enjoy! 💻

    Prepare basic HTML and CSS structure

    We begin with our HTML and CSS structure. We create an HTML <div> element that has a class called rainbow-effect. Then, we set some rules in CSS that are applied to our HTML element. So, let’s move forward and analyze our CSS code snippet.

    <body>
      <div class="raibow-effect">rainbow effect</div>
    </body>
    HTML
    body {
      background-color: #050c20; /* deep blue */
    }
    
    .rainbow-effect {
      text-align: center;
      color: white;
      font-size: 180px;
      font-weight: bold;
      font-family: 'Roboto', sans-serif;
    }
    CSS

    First of all, we set the background color of our body to be a deep blue. Then, we proceed with our text. We create a center aligned, white 180px text with bold and highly legible fonts, as we specifically seek a font with excellent readability.

    Once set, we can then proceed with our tweaks in order to infuse the text with the enchanting hues of a rainbow. The following image shows what is rendered on the screen for the time being. 😃

    This image shows our text with its basic characteristics.

    Apply the rainbow effect

    Within the style rules of the .rainbow-effect, we find specific directives regarding our rainbow effect:

    
    .rainbow-effect {
      ...
      background-image: linear-gradient(
        to right, red, orange, yellow, green, blue, indigo, violet
      );
      background-clip: text;
      color: transparent;
    }
    
    CSS

    background-image: linear-gradient
    The first thing we need to know is that by using the background-image CSS property we are able to create a background with more than one color.

    We do so by setting the linear-gradient value, and we are free to choose any color and any direction we want for our text. In our case, we use the to right direction and the gradient starts with the color red on the left and smoothly transitions through orange, yellow, green, blue, indigo, and violet as it moves from left to right. So, it gives a colorful, horizontal stripe-like background.

    The rainbow effect word with a rainbow effect as a background. This happens as we set the CSS background-image property to linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet)

    You are always free to choose any direction of the linear-gradient you like! 👍

    background-clip: text
    We continue our work with the background-clip property which is used to define how the background should be clipped or masked. In our case, it’s set to text, which tells the browser to apply the background gradient only to the text inside our div.

    The rainbow effect word after setting the -webkit-background-clip CSS property to text. We can see that for now our text is white with the body's background.

    What? Nothing happened yet? Why? Using this property, the colorful background is applied to the text, but the effect is not visible yet because it is necessary to proceed to our next step 🧐 ⬇ in order to achieve the final and desired results. So, let’s move on!

    color: transparent
    Finally, adding the color property to transparent renders the text itself invisible, allowing the colorful background to show through the text. And there it is! 🥳

    The rainbow effect word with the css rainbow effect after setting color CSS property to transparent. We are able now to see that our text inherits the colors of the rainbow. So, now we can see a completely colorful text.

    So, in summary, putting it all together, when you use this code, you’ll have a text with a colorful gradient background (rainbow colors) that appears within the text. The text itself is invisible, creating a striking and colorful text effect. 🎉

  • Transform Your Text: Black and White CSS Stripes Made Easy

    Transform Your Text: Black and White CSS Stripes Made Easy

    Welcome to a world where ⚫ black and ⚪ white aren’t just colors. In this post, 😃 we’ll explore the exciting world of creating black and white CSS stripes. It is a really cool effect to level up your text by adding stripes, making it even more fascinating and appealing.

    We will be learning about this effect by using an example to make it crystal clear. Let’s check it out! 👩‍💻

    Create basic HTML and CSS structure

    We will begin with our HTML and CSS structure. Our HTML code includes a <div> element that has a class named .stripes-effect for identification and styling purposes. Following that, we add some CSS rules to apply specific styles to our HTML element with this class.

    <body>
      <div class="stripes-effect">black & white text with shadow</div>
    </body
    HTML
    body {
      background-color: black;
    }
    
    .stripes-effect {
      font-family: 'Bungee', sans-serif;
      text-align: center;
      color:  white;
    }
    CSS

    By doing so, our heading is ready for applying our CSS stripes effect and should now look like this

    This image shows a white text with a black background

    Adding black and white vertical stripes

    Now that we have added our basic structure, we’ll create our stripe effect gradually, step by step, until it’s perfected. Let’s add the following styling

    .stripes-effect {
      ...
      background-image: linear-gradient(to right, white, black, ...);
      /* clips the background pattern */
      background-clip: text;
      /* makes text invisible */
      color: transparent;
    }
    CSS

    In our already existing .stripes-effect class, we have the following rules:

    background-image: linear-gradient(to right, white, black, ...) ➡ We begin by setting this CSS property that creates a background pattern using a gradient of alternating black and white stripes from left to right. The default direction is from top to bottom.

    This image shows a white text with black and white background that comes from the CSS property background-image: linear-gradient(to right, white, black, ...) CSS property.

    Don’t worry if our black-and-white text is hard to read; 🕯 😂 it is a temporary phase just to serve our purpose for now. We will move forward and see! So let’s proceed immediately! ⏳

    background-clip: text ➡ By adding this property, it clips the background pattern to the shape of the text, making the text appear as if it’s filled with black and white stripes. If we just add this property and leave our CSS settings without any other change, our effect will not show properly.

    This image shows that the browser clips the background when we set the -webkit-background-clip: text CSS property.

    If we want this to see our effect it is necessary to proceed with the following step (color: transparent ⬇).

    color: transparent ➡ It’s time to make the text transparent, enabling the background pattern we created in the previous step to be visible!

    This image shows the color: transparent CSS property. We now see our text having a black and white - css zebra effect.

    Black and white CSS stripes variations

    The Zebra effect is not limited to vertical stripes (linear-gradient) for your texts; you can explore more options and create any effect you want. Below, you will find some variations to give you the inspiration you need.

    Horizontal striped text

    .stripes-effect {
      ...
      background-image: linear-gradient(white, black, ...);
    }
    CSS
    This image shows the CSS stripes effect but with horizontal lines direction.

    Diagonal striped text

    .stripes-effect {
      ...
      background-image: linear-gradient(to bottom right white, black, ...);
    }
    CSS
    This image shows the black and white CSS stripes effect but with diagonal lines direction.
  • CSS Radial Gradient: How To Make Colorful Infinite Loops

    CSS Radial Gradient: How To Make Colorful Infinite Loops

    Greetings! 😃 Utilizing CSS radial gradient techniques is a remarkable approach for vibrant, colorful combinations. Gradients give us the liberty to choose any desired direction, defined by a clear starting and ending point. Using a minimum of two colors is essential, but we are free to blend even more based on our needs. This lets us achieve progressions or variations based on our specific requirements.

    In today’s post, we will analyze the captivating world of CSS radial gradient techniques. 🌈✨ Imagine colors coming out from a central point, spreading outwards in a circular fashion—an effect 🌀 that can truly elevate your design.

    Radial gradients offer a versatile approach to blending colors, creating central points or smooth transitions. By mastering radial gradients, you unlock the potential to infuse depth and excitement into your web design.

    Excited to learn more about this captivating technique? Let’s dive 🤿 right in! 💻

    Definition of a radial gradient

    A radial gradient is a visual effect in which colors blend outward from a central point, creating a smooth transition from one color to another in a circular or elliptical pattern. Circular ones spread colors outward from the center, evenly, making a symmetrical look. Elliptical ones also start from the center but stretch the colors toward the edges, creating an oval appearance.

    A radial gradient is a visual effect in which colors blend outward from a central point, creating a smooth transition from one color to another in a circular or elliptical pattern

    The default CSS radial gradient

    We’ll start by exploring the default orientation for the radial gradient which starts in the center of our elements and spreads outward. To better understand, look at the following piece of code and the pictures that go with it.

    The first picture shows a circle, while the second one depicts an ellipse.

    .radial-default {
      background-image: radial-gradient(red, green, blue);
    }
    
    /* circle default */
    .box-square {
      width: 240px;
      height: 240px;
    }
    
    /* elliptical default */
    .box-rectangle {
      width: 340px;
      height: 240px;
    }
    CSS

    Center at sides

    We can change the center of our element by setting circle at left , circle at top , circle at bottom and circle at right. To understand this better we’ve prepared an example. As before, the left picture relates to the circle, whereas the second one refers to the ellipse.

    .radial-at-side {
      background-image: radial-gradient(circle at top, red, green, blue);
    }
    
    /* circle default */
    .box-square {
      width: 240px;
      height: 240px;
    }
    
    /* elliptical default */
    .box-rectangle {
      width: 340px;
      height: 240px;
    }
    CSS

    Center at corners

    Also, the diagonal direction of our circle can change if we combine any corner with its adjacent sides.

    .radial-at-corner {
      background-image: radial-gradient(circle at top right, red, green, blue);
    }
    
    /* circle default */
    .box-square {
      width: 240px;
      height: 240px;
    }
    
    /* elliptical default */
    .box-rectangle {
      width: 340px;
      height: 240px;
    }
    CSS

    CSS Radial gradient using %

    With less blend

    We are also up to play with the blend we want to create. In the following example, the gradient blends between various colors in a circular pattern, it begins with red at the center, transitioning to green, then blue, purple, and finally orange at the outer edge.

    .radial-less-blend {
      background-image: radial-gradient(
        red 0%, red 20%, 
        green 30%, green 50%, 
        blue 60%, blue 100%
      );
    }
    
    /* circle default */
    .box-square {
      width: 240px;
      height: 240px;
    }
    
    /* elliptical default */
    .box-rectangle {
      width: 340px;
      height: 240px;
    }
    CSS

    🕵️‍♂️ In this example, I’ve divided the space into 3 sections. I left a 10% blend in each space in order to create a smooth small transition. The percentages between the color stops, determine how smoothly the transition between colors happens.

    • Red (0%-20%): The gradient starts at the center (0%) with the red color.
    • Red to Green (20%-30%): Within this radial range, there is a subtle transition from red to green, creating a visually appealing blend.
    • Green (30%-50%): the gradient takes a solid green color.
    • Green to Blue (50%-60%): Between this radial distance, there’s a gentle transition from green to blue.
    • Blue (60%-100%): Finally, the gradient concludes with a blue hue, providing a vibrant and visually striking finish.

    Without blend

    We also have the option to make non-blend gradients. As you can see below, the gradient consists of multiple color stops, transitioning from red to orange in a radial pattern, like colorful rings. Each color is assigned to specific percentage intervals, creating a visually appealing gradient effect.

    .radial-no-blend {
      background-image: radial-gradient(
        red 0%, red 33%, 
        green 33%, green 66%, 
        blue 66%, blue 100%
      );
    }
    
    /* circle default */
    .box-square {
      width: 240px;
      height: 240px;
    }
    
    /* elliptical default */
    .box-rectangle {
      width: 340px;
      height: 240px;
    }
    CSS

    🕵️‍♂️ In this example, I’ve divided the space into 3 sections. There is no blending among them. We can see a shape like a target, 🎯 that creates clear bands of sharp colors.

    • Red: Starts at 0% and ends at 33%.
    • Green: Starts at 33% and ends at 66%.
    • Blue: Starts at 66% and ends at 100%.
  • CSS Colorful Text – Crafting Vibrant Effects

    CSS Colorful Text – Crafting Vibrant Effects

    Hello, everybody 😃 Get ready to add a vibrant twist to your web designs with my latest post on fonts. In this post, we’ll explore the fascinating world of typography, sharing clever ways to add a burst of colors, outlines, shadows, and CSS colorful text. Whether we are looking to level up designs or experiment with CSS, this post provides the inspiration and know-how to make texts truly stand out on your screen. Stay tuned for an amazing journey into the art of CSS typography! 🌈✨

    We already know the color CSS property. When setting the text color, we’re setting the color of the text itself. In contrast, setting the background-color sets the background color behind the text. But what if we want a more challenging font? Can we do that? Absolutely!

    Below, I prepared an example as a way to make it more understandable. Enjoy! 💻

    Preparing our HTML and CSS structure

    The following code creates a colorful text with gradient, outline, and shadow. We will start with our HTML structure. Our body has background-color: black. Inside, we make an HTML div element that serves as a container for our text and has a class attribute named font-effects.

    <body>
      <div class="font-effects">
        colorful text with gradient, outline & shadow is so impressive
      </div>
    </body>
    HTML

    Next, let’s proceed with our CSS structure. The font-effects class contains the rules applied to the HTML element mentioned earlier. We’ll provide a thorough examination of these rules as we progress through this post. For now, it’s important to note that our text has color white, our body has background-color black, and we’ve also integrated (@import url(...)) a font-family of Google Fonts.

    Ensure this statement is placed at the beginning of your CSS code snippet, just like I did (check line 2).

    /* insert google fonts */
    @import url(
      'https://fonts.googleapis.com/css2?family=Stick No Bills'
    );
    
    body {
      background-color: black;
    }
    
    .font-combinations {
      width: 1100px;
      font-size: 150px;
      color: white;
      font-family: 'Stick No Bills', sans-serif;
      text-align: center;
    }
    CSS

    The following image shows what is rendered on the screen now.

    Explaining the CSS colorful text effect

    Inside the .font-effects style rules, we include the following instructions to create these amazing fonts:

    .font-combinations {
      ...
      /* adding colors */
      background-image: linear-gradient(
        to right bottom, red 0, green 15%, orange 25%, pink 25%,
        transparent 27%, indigo 27%, orange 50%, black 50%,
        transparent 52%, green 52%, indigo 73%,
        transparent 73%, pink 75%, orange 75%, green 90%,
        red 100%
      );
      /* Makes the text shape match the background */
      -webkit-background-clip: text;
      color: transparent;
        /* adding outline to text */
      -webkit-text-stroke-width: 1px;
      -webkit-text-stroke-color: pink;
      /* adding shadow to text */
      filter: drop-shadow(-2px 2px 2px rgba(250, 190, 210, 0.8));
    }
    CSS

    Adding the linear gradient effect

    background-image: linear-gradient(...) ➡ This CSS rule creates a background gradient using the linear-gradient function. The gradient begins with red, transitions to green, and then shifts to orange. It then transitions to pink, becomes transparent, then indigo, returns orange becomes transparent once more, shifts to green, then indigo, then transparent again, returns to pink, then orange for the third time, then green, and finally returns red again.

    Remember that this gradient will be used as the background for our text. Isn’t this awesome? 😎

    -webkit-background-clip: text ➡ We continue with this CSS rule that tells the browser to clip the background gradient to the shape of the text. We are not ready yet to see the colorful background as text. 😕 We just prepared the space (fonts). Don’t worry we will proceed with our work and see the amazing result! 😉

    color: transparent ➡ This CSS rule makes the actual text content transparent. This allows the colorful gradient to show through the text 🥳, and there it 🥁 is!

    Adding the outline effect

    -webkit-text-stroke: 2px red ➡ Then we add a pink outline or stroke with a width of 2 pixels. This makes the text more visible against the background gradient.

    🔖 We are free to write it more analytically setting the following two CSS properties -webkit-text-stroke-width and -webkit-text-stroke-color. It’s up to you!

    Applying the shadow effect

    filter: drop-shadow(-2px 2px 2px rgb(250, 190, 210, 0.8)) ➡ To finalize our work we add a shadow to the entire section, with an offset of -2 pixels to the left, 2 pixels down, a blur radius of 2 pixels, and a subtle pink shadow rgba(10, 10, 10, 0.8). This deep shadow adds a subtle but noticeable darkening effect to our text.

    To infuse our text with a touch of fantasy and vibrance 🎉 ✨, we can use a brighter color for the outline and change the shadow to match. For example, we could create a vivid or dark background as a way to create contrast and then swap out the pink outline and shadow for a more vibrant magenta. In the picture below, you can see how these small changes make a big difference, giving a more colorful and bright result.