Tag: text

Small, practical tips on styling text with CSS

  • The CSS Text Shadow Property – Enhance Your Content

    The CSS Text Shadow Property – Enhance Your Content

    Hello everybody! In the land of web design, the CSS text shadow property is like adding magic to your text. It helps you create elegant headings that command attention and, many times, make text easier to read. The text-shadow empowers designers to pass beyond the limits of ordinary with just a few lines of simple yet powerful code.

    However, it’s essential to use it wisely, overdoing it can sometimes cause confusion and reading can end up difficult. Therefore, we must keep in mind that beyond styling, readability is also important. Always aim to strike a balance between appearance and clarity so our text is accessible to everyone.

    Text shadow structure

    First things first! We’ll begin with the structure and break down its components:

    • Offset-X and Offset-Y: They determine the horizontal and vertical distances of the shadow. When we use positive values, the shadow moves to the down and right. When we use negative values, the shadow moves to the top and left.
    • Blur-radius: It specifies the extent of blurring for the shadow. A higher value creates a spread, while a lower value sharpens the shadow.
    • Color: Here, we set the color of the shadow. All color methods are accessible (color names, hexadecimal codes, rgba and hsla values).

    If we don’t want to use a specific color, our shadow defaults to black.

    Below, I have prepared some examples to make this amazing tool more understandable. I’ll use the charming “Pacifico” font with the text “Text Shadow” to showcase its capabilities. So, let the game begin!! 😃

    Text shadow with positive values

    In our first example, we use positive values and create a gray shadow 5 pixels to the bottom and right of our text. It has a blur radius of 5 pixels, giving it a softened appearance.

    .text-shadow {
      text-shadow: 5px 5px 5px gray;
    }
    A shadow of 5px 5px 5px gray

    Text shadow with negative values

    Next, we create a gray shadow 5 pixels to the top and left of our text, using negative values. It has a blur radius of 5 pixels.

    .text-shadow {
      text-shadow: -5px -5px 5px gray;
    }
    A shadow of -5px -5px 5px gray

    Text shadow with colors

    Nothing better than playing with colors!! 🌈 In that case, we add two vibrant colors: magenta and cyan, then finish our shadow with color gray. Cool hug!? 😎
    As shown in the following code snippet, to create a repeating shadow with different colors, we must increase the pixels along both the X-axis and the Y-axis each time we add a new color.

    .text-shadow3 {
      text-shadow: 2px 2px 2px magenta, 4px 4px 2px cyan, 6px 6px 5px gray;
    }
    A shadow of 2px 2px 2px magenta, 4px 4px 2px cyan, 6px 6px 5px gray

    Text shadow with high blur-radius

    ⛔ In this example, we increase the blur, and we are able to notice that it is very, very important to keep blur-radius at low values, otherwise, our text appears a bit confusing with poor readability.

    .text-shadow4 {
      text-shadow: 5px 5px 20px gray;
    }
    Ashadow of 5px 5px 20px gray

    Text shadow with high values

    Finally, let’s get creative. By increasing the values at both the X-axis and Y-axis, we can widen the gap between the text and its shadow, achieving a more strongly marked visual effect.

    .text-shadow {
      text-shadow: 70px 50px 5px gray;
    }
    A shadow of 70px 50px 5px gray

    Whether a shadow type is “good” depends on your design goals. For bold, eye-catching text that stands on the page, this approach can be very effective. If you’re going for a more subtle or minimalistic design, you might opt for smaller offsets and blurs. It’s all about finding the balance that fits your overall design concept!

    Utilizing the text shadow, you are not only creating a stylish effect, but you are also crafting an experience that users will remember. So, get playful when using it. Experiment! Let your creativity shine through! ✨ 🎉

  • How To Build Stunning Rounded Text – Handy Tips

    How To Build Stunning Rounded Text – Handy Tips

    Greetings, all! 😃 I’m excited to share an incredible CSS technique with you today. We’ll learn little by little how to create impressive and rounded text. This technique can give our text a unique and captivating appearance that stands out from the usual. Get ready to take your text to the next level! 🧨 ⚡

    Are you interested in learning how to uplevel your typography? Stick around to explore the endless possibilities of CSS and take your website to new heights! Let the game 🌀 begin and happy designing! 😊

    HTML structure

    To create a text that appears in a rounded effect we begin with the HTML structure. First, we need an HTML div with a specific class. Let’s call it .wrapper. This div will be the container where the text will be displayed. To achieve the desired effect, we also need to add a span element for each character we want to use. By doing so, it allows us to handle and move each character separately and create the shape we want. 😉

    In our example, we will use 15 letters and a star, so we need to add 16 spans. Each span represents a character. You can see the code snippet below for a better understanding.

    <div class="wrapper">
      <span class="character1">I</span>
      <span class="character2">a</span>
      <span class="character3">m</span>
      <span class="character4">a</span>
      <span class="character5">r</span>
      <span class="character6">o</span>
      <span class="character7">u</span>
      <span class="character8">n</span>
      <span class="character9">d</span>
      <span class="character10">e</span>
      <span class="character11">d</span>
      <span class="character12">t</span>
      <span class="character13">e</span>
      <span class="character14">x</span>
      <span class="character15">t</span>
      <span class="character16-emoticon"></span>
    </div>
    HTML

    CSS structure

    We move forward with the CSS. We begin by styling the wrapper HTML element with a width and height of 400 pixels. It will also have a purple background-color, an inset magenta shadow (the inset box-shadow is a clever idea 💡 to create a distinctive boundary inside our wrapper, which will help us later with the positioning), and a border-radius of 50%, giving it a completely round shape. Finally, the flex method will perfectly align our text inside the wrapper.

    Next, we will apply some styling to the spans within the wrapper. They will have a font-family: Arial (we need a really distinct font), a font-size of 40 pixels, and will be colored in a yellowish shade (#eddc42).

    🔖 Note that we won’t add spaces between characters since we will place them one by one. By avoiding spaces, we can achieve precise and accurate positioning, which allows for greater control and flexibility in our design.

    .wrapper {
      width: 400px;
      height: 400px;
      background-color: purple;
      box-shadow: inset 0 0 0px 60px magenta;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
     span {
      font-family: Arial;
      font-size: 40px;
      color: #eddc42;
    }
    CSS

    Below, we can see what is generated on the screen for now. Well, 🤔 in fact, I’m not a rounded text yet! 😃 So, let’s move on!

    Preparation before starting to position the letters

    To be able to make the positioning, we set position: relative property to the wrapper and position: absolute property to the span as a way to move them freely. By doing so, all characters take the same place, but we can observe only the last one as it is on the top.

    .wrapper {
      position: relative;
    }
    
     span {
      position: absolute;
    }
    CSS

    Now, we can see what is currently shown on the screen.
    While I’m not a looping message so far, 🤪 I will be soon! Let’s proceed. 😃

    Creating the rounded shape

    Starting from the two ends and going toward the middle side is a smart tactic to divide the space equally. Remember, we have a star that we will put in the center of the circle, so we do not count it. Thus, we initiate our positioning from the letters “Ι and t”, the first and last letter of our phrase, and place them in the middle of axis-Y by setting top: 50% and transform: translate(-50%) .

    Also, we keep the letters 40 pixels away from the left and right sides, with the left and right CSS properties respectively.

    Finally, transforming our letters setting the transform: rotate() gives them a vibrant and dynamic perspective, bringing them to life in a truly inspiring way.

    .character1 {
      left: 40px;
      top: 50%;
      transform: translate(0, -50%) rotate(-90deg);
    }
    
    .character15 {
      right: 40px;
      top: 50%;
      transform: translate(0, -50%) rotate(90deg);
    }
    CSS

    Now, take a look at this sequence of characters. Notice how both the first and last letters are in their respective positions on the displayed screen. This is a good time to examine how the box-shadow CSS property helps us to count and place the characters accurately. 🟣 🤩 🟣 🤩 🟣

    We move forward with this topic by counting the remaining characters. Ι know! I know! It can be a bit tricky and confusing 🤯 because of the counting, but the result will be amazing!! ✨ 🎉 Therefore, please ensure to maintain the positioning using the same tactic consistently. Finally, I’m including the rest of the code snippet below to complete my work.

    .character2 {
        transform: rotate(-75deg);
        left: 38px;
        top: 144px;
      }
      
      .character3 {
        transform: rotate(-65deg);
        left: 42px;
        top: 113px;
      }
    
      .character4 {
        transform: rotate(-45deg);
        left: 80px;
        top: 68px;
      }
      
      .character5 {
        transform: rotate(-32deg);
        left: 120px;
        top: 42px;
      }
      
      .character6 {
        transform: rotate(-20deg);
        left: 140px;
        top: 32px;
      }
      
      .character7 {
        transform: rotate(-10deg);
        right: 208px;
        top: 25px;
      }
      
      .character8 {
        transform: rotate(5deg);
        right: 175px;
        top: 24px;
      }
      
      .character9 {
        transform: rotate(22deg);
        right: 145px;
        top: 30px;
      }
      
      .character10 {
        transform: rotate(30deg);
        right: 118px;
        top: 42px;
      }
      
      .character11 {
        transform: rotate(42deg);
        right: 90px;
        top: 60px;
      }
      
      .character12 {
        transform: rotate(65deg);
        right: 60px;
        top: 100px;
      }
      
      .character13 {
        transform: rotate(65deg);
        right: 45px;
        top: 122px;
      }
      
      .character14 {
        transform: rotate(80deg);
        right: 38px;
        top: 152px;
      }
    CSS

    As we can see, all letters are in their respective positions on the displayed screen and our text is finally taking a rounded shape. 🟣 🤩 🟣 🤩 🟣

    To finalize, it would be better if the star appears bigger so we modify the .character16-emoticon class and adjust the font-size property to 100px. Additionally, the box-shadow property needs to be updated to achieve the desired visual effect. Therefore, we will need to go back and make the necessary changes to ensure it looks exactly as we want it to.

    .wrapper {
      ...
      box-shadow: inset 0 0 30px 10px magenta;
    }
    
    .character16-emoticon {
      font-size: 100px;
    }
    CSS

    Tada! Our rounded text is ready! 🥳 💪 Enjoy! 🎊 🎊

    Complete code solution

    Below is the full code referenced in this blog post. Feel free to copy and use it in your own projects. If you have any questions or encounter any issues, don’t hesitate to reach out for assistance. You can easily copy the desired code snippet by clicking on the copy icon, located in the top-right corner of each snippet.

    <div class="wrapper">
      <span class="character1">I</span>
      <span class="character2">a</span>
      <span class="character3">m</span>
      <span class="character4">a</span>
      <span class="character5">r</span>
      <span class="character6">o</span>
      <span class="character7">u</span>
      <span class="character8">n</span>
      <span class="character9">d</span>
      <span class="character10">e</span>
      <span class="character11">d</span>
      <span class="character12">t</span>
      <span class="character13">e</span>
      <span class="character14">x</span>
      <span class="character15">t</span>
      <span class="character16-emoticon"></span>
    </div>
    HTML
    Expand
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
    
    html,
    body {
      height: 100vh;
    }
    
    body {
      background-color: #f5f5f5;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .wrapper {
      width: 400px;
      height: 400px;
      background-color: purple;
      box-shadow: inset 0 0 0px 60px magenta;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
     span {
      font-family: Arial;
      font-size: 40px;
      color: #eddc42;
    }
    
    .character1 {
      left: 40px;
      top: 50%;
      transform: translate(0, -50%) rotate(-90deg);
    }
      
    .character2 {
      transform: rotate(-75deg);
      left: 38px;
      top: 144px;
    }
      
    .character3 {
      transform: rotate(-65deg);
      left: 42px;
      top: 113px;
    }
    
    .character4 {
      transform: rotate(-45deg);
      left: 80px;
      top: 68px;
    }
      
    .character5 {
      transform: rotate(-32deg);
      left: 120px;
      top: 42px;
    }
      
    .character6 {
      transform: rotate(-20deg);
      left: 140px;
      top: 32px;
    }
      
    .character7 {
      transform: rotate(-10deg);
      right: 208px;
      top: 25px;
    }
      
    .character8 {
      transform: rotate(5deg);
      right: 175px;
      top: 24px;
    }
      
    .character9 {
      transform: rotate(22deg);
      right: 145px;
      top: 30px;
    }
      
    .character10 {
      transform: rotate(30deg);
      right: 118px;
      top: 42px;
    }
      
    .character11 {
      transform: rotate(42deg);
      right: 90px;
      top: 60px;
    }
      
    .character12 {
      transform: rotate(65deg);
      right: 60px;
      top: 100px;
    }
      
    .character13 {
      transform: rotate(65deg);
      right: 45px;
      top: 122px;
    }
      
    .character14 {
      transform: rotate(80deg);
      right: 38px;
      top: 152px;
    }
    
    .character15 {
      right: 40px;
      top: 50%;
      transform: translate(0, -50%) rotate(90deg);
    }
    
    .character16-emoticon {
      font-size: 100px;
    }
    
    CSS
    Expand

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

  • CSS Water Drop Effect: How to Make Text Look Wet & Glossy

    CSS Water Drop Effect: How to Make Text Look Wet & Glossy

    😃 In this post, we are beyond excited to show you how to create a breathtaking water drop effect that stands on top of a text using only the power of CSS.

    We will confidently guide you through every single step of the process, from the initial design phase to the final finishing touches.

    In addition, we will share expert tips on how to masterfully experiment with CSS properties to achieve the perfect shape and reflection effects. So, let’s jump right in and create something fantastic together!

    Setting up the HTML structure for the water drop effect

    We begin with the HTML structure. We need to create an element with the class name .wrapper. This element will have two child elements. The first child element will be dedicated to the text, so we give a suitable class name, such as .text. Similarly, we should name the second child element with a class name that reflects its purpose, such as .drop.

    <div class="wrapper">
      <div class="text">drop</div>
      <div class="drop"></div>
    </div>
    HTML

    Our top priority right now is to work on the second child element, which is our amazing drop. 💦 🤓 Once we’re done with that, we’ll move on to the text.

    Styling the water drop effect with CSS

    We move forward with the CSS structure. To create a flexible layout for our project, we set the flex property on the element with the class .wrapper. This will allow us to easily adjust the size and position of its child elements.

    Additionally, we added the position: relative property to the wrapper to establish a reference point for any absolutely positioned child elements later on in the project. By doing this, we have prepared the necessary space and layout for easier and more precise positioning of elements.

    .wrapper {
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
    }
    CSS

    How to create a realistic water drop effect in CSS

    Firstly, we must select a color for the body, setting the background-color. Keep in mind that the same color must be used for the drop. Therefore, it is crucial to choose the color carefully. 🌈

    Then, we need to establish the dimensions and borders. Thus, we will set the width and height and then adjust the border-radius property to create a slightly rounded shape.

    Next, we maintain the body’s background-color by adjusting the transparency of the drop. In that way, our drop inherits the color of the body.

    Additionally, we add the box-shadow property which is the most crucial part as it is responsible for creating a realistic-looking drop that appears three-dimensional. Without it, the element may appear flat and lacking in depth. 😉 So, don’t be afraid to experiment with different shadow settings until you find the right combination that works for you. It’s truly amazing how much of a difference a small tweak-change can make!

    body {
      background-color: #5fc8e8; /* a light shade of blue */
    }
    
    .wrapper {
      ...
    }
    
    .drop {
      width: 210px;
      height: 220px;
      
      background-color: transparent;
      border-radius: 45% 50% 45% 55%;
      
      box-shadow: -2px -2px 10px 5px #0f9dc4, /* all around */
      5px 5px 10px #0796c1, /* top & right */
      inset 15px 15px 30px #0796c1, /* inset top & right */
      inset -29px -20px 50px #f2f4f7; /* inset left & bottom */
    }
    CSS

    This is what is rendered on the screen. For now, we continue to ignore the text and focus on our almost-ready 🙃 amazing drop!

    Adding shine to the water drop

    By utilizing the CSS properties :before and :after, we can create two new pseudo-elements without the need for additional HTML markup. This technique can be used to create a glancing effect. Both pseudo-elements have the same properties but with different values, which helps to differentiate them from each other and create a unique look.

    We can effortlessly position those glances within the drop element by using the CSS property position: absolute.

    Then, we specify their dimensions and the color by setting the width, height and background-color.

    Next, we modify the shadows and their shape by setting the box-shadow and border-radius .

    After that, we use the top and left properties to position them. Finally, to make them look even more realistic, we can add some rotation by using the transform: rotate() property.

    .drop {
      ...
      position: absolute;
    }
    
    .drop:before {
      position: absolute;
      content: "";
      width: 14%;
      height: 7%;
      background-color: #f5f5f5;
      box-shadow: 0 0 10px #f5f5f5;
      border-radius: 60% 45% 50% 60%/60% 45% 60% 50%;
      top: 15%;
      left: 20%;
      transform: rotate(140deg);
    }
      
    .drop:after {
      position: absolute;
      content: "";
      width: 10%;
      height: 5%;
      background-color: #fff;
      box-shadow: 0 0 10px #fff;
      border-radius: 50% 45% 45% 60%/50% 50% 40% 55%;
      top: 25%;
      left: 10%;
      transform: rotate(-45deg);
    }
    CSS

    After adding these glances, we can see our final drop. 💦 ✨ It’s pretty cool, isn’t it?

    Adjusting text appearance beneath the water drop effect

    We are moving forward by adjusting our text and making it more visually appealing. I have selected the “Lobster” font-family with a font size of 140 pixels, a warm dark orange, and a black 2px text-shadow.

    In case we wish to use another font-family than the usual ones, we need to insert it into our CSS. We do so by setting the @import url(...). Ensure this statement is placed at the beginning of your CSS code snippet, just like I did. Check below. 👇

    @import url('https://fonts.googleapis.com/css?family=Lobster');
    
    .text {
      font-family: "Lobster", sans-serif;
      font-size: 140px;
      color: #e85a5a; /* a shade of warm dark orange */
      text-shadow: 2px 2px 2px black;
    }
    CSS

    Take a closer look now. The text appears so different behind the water drop. It’s quite impressive, don’t you think? 😎

    One last step, and we are ready! We are free to place our text wherever we want by setting the position: absolute , top and left CSS properties in order to move it.

    We also have full control over the placement of our text. This can be achieved by confidently adjusting the CSS properties position: absolute , top and left.

    .text {
      ...
      position: absolute;
      top: -45px;
      left: -35px;
    }
    CSS

    The final step is complete! Congratulations! 🥳 You have the option to either keep the original design or create your own. Please remember that the most important thing is to combine the appropriate colors 🌈 and shadows; this is necessary for our drop to look realistic.

    Full CSS water drop effect code (copy & paste ready)

    Below is the full code referenced in this blog post. Feel free to copy and use it in your own projects. If you have any questions or encounter any issues, don’t hesitate to reach out for assistance. You can easily copy the desired code snippet by clicking on the copy icon, located in the top-right corner of each snippet.

    <div class="wrapper">
      <div class="text">drop</div>
      <div class="drop"></div>
    </div>
    HTML
    @import url('https://fonts.googleapis.com/css?family=Lobster');
    
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
    
    html,
    body {
      height: 100vh;
    }
    
    body {
      background-color: #5fc8e8;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .wrapper {
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
    }
    
    .text {
      position: absolute;
      font-family: "Lobster", sans-serif;
      font-size: 140px;
      color: #e85a5a;
      text-shadow: 2px 2px 2px black;
      top: -45px;
      left: -35px;
    }
    
    .drop {
      width: 210px;
      height: 220px;
      background-color: transparent;
      border-radius: 45% 50% 45% 55%;
      box-shadow: -2px -2px 10px 5px #0f9dc4, /* all around */
      5px 5px 10px #0796c1, /* top & right */
      inset 15px 15px 30px #0796c1, /* inset top & right */
      inset -29px -20px 50px #f2f4f7; /* inset left & bottom */
      position: absolute;
    }
    
    .drop:before {
      position: absolute;
      content: "";
      width: 14%;
      height: 7%;
      background-color: #f5f5f5;
      box-shadow: 0 0 10px #f5f5f5;
      border-radius: 60% 45% 50% 60%/60% 45% 60% 50%;
      top: 15%;
      left: 20%;
      transform: rotate(140deg);
    }
    
    .drop:after {
      position: absolute;
      content: "";
      width: 10%;
      height: 5%;
      background-color: #fff;
      box-shadow: 0 0 10px #fff;
      border-radius: 50% 45% 45% 60%/50% 50% 40% 55%;
      top: 25%;
      left: 10%;
      transform: rotate(-45deg);
    }
    CSS
    Expand
  • How To Create Stunning Vibrant Neon Effect – CSS Only

    How To Create Stunning Vibrant Neon Effect – CSS Only

    The neon effect in web design brings that bold, electric vibe that grabs attention right away. ⚡🌈 Inspired by real-life neon signs, which I’m sure you have seen outside bars, arcades, or glowing up city streets, it mixes retro charm with a modern twist. It adds personality and mood, turning plain text or shapes into glowing, eye-catching pieces. That soft glow, the depth, those bright color fades — they take a simple design and make it feel alive, as if you have just travelled back in time. 🌟 And the best part? You can pull it off with just HTML and CSS. No images, no JavaScript. 🥳

    Setting the stage: Basic HTML structure

    To begin creating this effect, we’ll start with a basic HTML structure and add custom CSS later. Think of the HTML <div> we are using, as the frame for a neon sign, and the text as the glowing message inside it.

    <div class="neon-effect">Neon Vibes Simple Css</div>
    HTML

    From there, we move to CSS structure. We import a Google font named “Orbitron”, a futuristic style text, that fits perfectly for our neon effect.

    Then we lay the foundation: we structure the page by setting the body to fill the entire viewport and using display: flex to center our neon box both vertically and horizontally. Finally, we add a solid black background — it doesn’t look like much yet, but it sets the perfect stage for the neon glow we’ll add soon, creating strong contrast just like a real sign glowing in the dark.

    @import url('https://fonts.googleapis.com/css?family=Orbitron');
    
    body {
      max-width: 100%;
      height: 100vh;
      
      display: flex;
      align-items: center;
      justify-content: center;
      
      background-color: #000;
    }
    CSS

    Building the neon sign base

    The .neon-effect class is used to create the main structure of the glowing sign. It defines a rectangular box with a width of 700px and a height of 300px, along with a soft, rounded border in light violet (#f4cbf8).

    The box uses display: flex to perfectly center the text both vertically and horizontally. The font is set to Orbitron, giving the text a bold, futuristic style, and its size is large (80px) to make it stand out.

    .neon-effect {
      /* Frame */
      width: 700px;
      height: 300px;
      border: 6px solid #f4cbf8; /* light violet */
      
      border-radius: 20px;
      display: flex;
      align-items: center;
      justify-content: center;
      
      /* Fonts */
      font-family: 'Orbitron', Arial;
      font-size: 80px;
      text-align: center;
      color: #faf0fb; /* light pink */
    }
    CSS
    Building the neon sign base (frame and text) to create the neon effect.

    The text color is a very light pink (#faf0fb), which will work beautifully once we add glowing shadow effects around it. For now, this creates a clean and centered base — the canvas for our neon sign.

    Glowing borders: Neon frame with box-shadow

    To create the glowing neon frame around the box, we use layered box-shadow effects. The outer shadows softly expand in multiple directions, starting with white and transitioning through vivid shades of pink, magenta, and purple. This gives the impression of light softly spreading from the edges.

    We also include a subtle touch of yellow-gold hue, blending into the glow. This not only adds visual warmth but also gives a nostalgic nod to vintage neon signs, bringing up the charm of the old days while keeping the overall look fresh and vibrant.

    .neon-effect {
      ...
      box-shadow:
        /* outer glow */
        0 0 2px #fff, /* white */
        0 0 6px #ff99ff, /* light pink */
        0 0 12px #ff33ff, /* magenta */
        0 0 20px #cc00ff, /* violet */
        0 0 28px #9900cc, /* deep purple */
        0 0 36px #660066, /* dark purple */
        0 0 40px #ffe187, /* light yellow - soft gold */
        /* inner glow */
        inset 0 0 4px #ff99ff, /* light pink */
        inset 0 0 8px #ff33ff, /* magenta */
        inset 0 0 14px #cc00ff, /* violet */
        inset 0 0 18px #9900cc, /* deep purple */
        inset 0 0 24px #660066; /* dark purple */
      }
    CSS

    Equally important is the second group, which uses the inset keyword and adds an inner glow that shines inside the box. These inset shadows create depth and give the illusion that the light is not only around the sign, but also glowing from within. The combination of outer and inset shadows is essential for achieving a rich, realistic neon effect.

    Styling the neon frame with pink, magenta, purple and yellow-gold hues setting the box shadow CSS property.

    Illuminated Text: Neon Glow with Text-Shadow

    To create the glowing effect around the text, we use the same method, multiple layers of text-shadow. Each shadow in your code adds a soft light in a different shade: from white and light pink to vibrant magenta, deep purple.

    .neon-effect {
      ...
      text-shadow:
        0 0 2px #fff, /* white */
        0 0 10px #ff99ff, /* light pink */
        0 0 20px #ff33ff, /* magenta */
        0 0 26px #cc00ff, /* violet */
        0 0 24px #9900cc, /* deep purple */
        0 0 32px #660066; /* dark purple *
    }
    
    CSS

    These layered shadows build a rich glow around each letter, giving it a strong, radiant presence against the dark background. The variation in color and blur size creates depth, making the text appear as if it’s lit from within, just like real neon tubing.

    Styling the neon text with pink, magenta and purple hues setting the text shadow CSS property.

    Neon effects in web design are a powerful way to grab attention. ✨ They combine vivid colors, glowing shadows, and sharp contrast to mimic the iconic look of neon signs. Whether you’re aiming for a modern tech vibe or a nostalgic retro feel, neon brings style and energy. Using CSS alone, we can recreate this classic visual with precision and creativity — no electricity needed! 💡😎

  • CSS Word Spacing – How to Do It Right

    CSS Word Spacing – How to Do It Right

    Hey everyone! 😃 In this post, we’ll take a look at the CSS property called word spacing. It controls the horizontal distance between words in a text. By default, the CSS word spacing is set to 0px, which is known as normal (word-spacing: normal). If you increase the spacing value, the distance between words will get bigger, while decreasing it will make the spacing smaller.

    Let’s take a closer look at this simple yet useful CSS property to gain a better understanding of it.

    HTML structure for CSS word spacing

    Let’s begin by creating an HTML document. In it, we include three headings <h1> that display the text “Hello World”. The first heading has the class .spacing-normal, the second heading has the class .spacing-big, and the third heading has the class .spacing-small. All headings contain the same text, as it allows an easy comparison. 👌

    <h1 class="spacing-normal">Hello World</h1>
    <h1 class="spacing-big">Hello World</h1>
    <h1 class="spacing-small">Hello World</h1>
    HTML

    CSS structure for CSS word spacing

    For our CSS structure, we set the word-spacing property for all three classes and differentiate them by assigning different values.

    .spacing-normal {
      word-spacing: normal;
    }
    
    .spacing-big {
      word-spacing: 100px;
    }
    
    .spacing-small {
      word-spacing: -50px;
    }
    CSS

    The image below illustrates the effect of varying word spacing values on each of our headings. The first heading has normal word spacing, while the second has a larger distance between words due to the increased word spacing value. Similarly, the third heading has a narrower spacing resulting from the decreased value.

    🔖 It is important to avoid using word spacing values that are either too large or too small.

    In summary, this image illustrates how adjusting the spacing between words can affect the appearance of text. It’s amazing how even small changes can have a significant impact. Isn’t it? 😎

  • CSS Letter Spacing – Working on The Correct Way

    CSS Letter Spacing – Working on The Correct Way

    Greetings! 😃 In today’s post, we will explore the CSS letter spacing property, which is responsible for the horizontal distance between letters. The default letter spacing is equivalent to 0px, known as normal (letter-spacing: normal). Increasing value results in bigger spacing.

    We will continue with some examples to understand better this easy but still useful CSS property.

    HTML structure for letter spacing

    We start with our HTML document by creating three <h1> headings with the text “Hello World”. All headings contain identical text to highlight the difference in letter spacing. The headings are styled differently, the first one uses  .spacing-normal class, the second one .spacing-small class, and the third one .spacing-big.

    <h1 class="spacing-normal">Hello World</h1>
    <h1 class="spacing-small">Hello World</h1>
    <h1 class="spacing-big">Hello World</h1>
    HTML

    CSS structure for letter spacing

    We continue our work with the CSS structure. We have assigned the letter-spacing property to all three classes but with different values. Even though the text is the same in all headings, they will appear different due to class variation.

    .spacing-normal {
      letter-spacing: normal;
    }
    
    .spacing-small {
      letter-spacing: 10px;
    }
    
    .spacing-big {
      letter-spacing: 50px;
    }
    CSS

    In the image provided, we can see the effect of varying letter spacing in css on the previously created headings. Increasing the letter spacing value results in greater distance between the letters, resulting in a more notable gap between them. The image clearly illustrates the relationship between letter spacing and letter distance.

    🔖 Note that letter spacing affects the distance between words, too.

    What to AVOID when using CSS letter-spacing property

    The letter spacing can support negative values. However, reducing the default letter spacing requires caution as it can negatively impact text legibility by causing letters to appear too close together. Here’s an example:

    .spacing-normal {
      letter-spacing: normal;
    }
    
    .spacing-negative {
      letter-spacing: -10px;
    }
    CSS
  • How to Make a Transparent Button Using HTML and CSS

    How to Make a Transparent Button Using HTML and CSS

    Hey there! 😃 In today’s technology-driven world, it’s super important to learn how to create an awesome transparent button. A well-designed button not only adds to the product’s aesthetic appeal but also enhances the user experience. Therefore, it’s essential to create buttons that are both visually appealing and functionally efficient.

    Let’s work together, utilizing only HTML and CSS, to design the perfect button that stands out and enhances your app’s user-friendliness.

    HTML basic structure

    First, we prepare our HTML code snippet. We need to create a parent element with the class .wrapper that acts as the base of the button. Next, we add a child element within the parent element that will serve as the clickable part of the button. This child element has the class .custom-button . Doing so will help us create an interactive button that users can click on, to perform an action. How amazing is this! 😎

    <div class="wrapper">
      <button class="custom-button"></button>
    </div>
    HTML

    CSS foundation

    Let’s continue by using our CSS magic and making our button look cool! For this post, I am writing CSS using Sass syntax. If you would like to convert it to vanilla CSS and don’t already know how, I’d suggest you use an online Sass —CSS converter.

    Create the base for the transparent button

    First of all, we set the background-color of the body to dark grey and also add some extra positioning properties in order for our button to be centered. We will be using the same color for our button, by applying the background: transparent CSS property, along with some width and height of our choice in the .wrapper class.

    We are also applying a border-radius of 80 pixels and a box-shadow with carefully selected shades of grey. It is important to select the appropriate shades to ensure the desired outcome. 😉

    For our example, we are placing the clickable part of the button in the center of the base. For that reason, we are using the flex method.

    body {
      background-color: darkgrey;
      height: 100vh;
      
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .wrapper {
      width: 500px;
      height: 140px;
      background: transparent;
      border-radius: 80px;
      box-shadow: inset 0px 3px 5px #c6c2c2,
        0px 5px 5px #727070;
    
      display: flex;
      align-items: center;
      justify-content: center;
    } 
    SCSS

    Take a look at the image below to see what’s currently rendered on screen.

    Create the clickable part of the transparent button

    We proceed with the clickable area of our button. After applying some basic dimensions, we need to make sure the background is set to transparent as we did before, with the base part of the button. After that, we adjust the border-radius and box-shadow to inherit, so that these attributes would be identical to the base. To remove any natively applied border styling we use border: none.

    .custom-button {
      width: 460px;
      height: 100px;
      background: transparent;
      border-radius: inherit;
      box-shadow: inherit;
      border: none;
    }
    SCSS

    Below, you see what’s on the screen now, with the clickable (top) part of our button added.

    Add the button text

    To begin, we use the flex method to center the button’s text appropriately. Then we add the text using the :before CSS pseudoselector, adding “hover me” as the content. I used a bold, 45-pixel blue text with a black shadow effect. For enhanced readability, I opted for the Arial font-family as it is really legible. 🆒 ✨

    .custom-button {
      ...
      font-family: 'Arial';
      font-size: 45px;
      color: #12528e; /* a shade of blue */
      font-weight: bold;
      display: flex;
      align-items: center;
      justify-content: center;
      &:before {
        position: absolute;
        content: "hover me";
        text-shadow: -2px -1px black;
      }
    }
    SCSS

    In the following image, we can see what’s displayed on the screen now.

    Apply the hover effect of the transparent button

    Now, is the appropriate time to implement the hover effect. We can achieve this by adding the :hover CSS pseudo-class with the cursor set to pointer. After that, we will use :before again to modify the text content to display “click me”.

    .custom-button {
      ...
      &:hover {
        cursor: pointer;
        &:before {
          content: "click me";
        }
      }
    }
    SCSS

    Below, we can observe 🔎 the hover effect in action. Moving the cursor over the button, immediately transforms from arrow ⬆ into pointer 👆(hand), and the text content changes. The hover effect is a widely used design technique that adds interactivity and visual interest to a webpage.

    Apply the active effect of the transparent button

    Now, we can add the :active state to the button to finish our work. Once we click on the button, the active state will be triggered. To make it look more realistic and impressive, we adjust the box-shadow CSS property.

    Additionally, we will modify the text content using the :before CSS property and change it to be inspiring and display the text “Good Job!” in indigo color with white text-shadow.

    .custom-button {
      ...
      &:active {
        box-shadow: 0px -1px 3px #969393,  /* top side */
          inset 0px 5px 3px #b7b5b5, /* inset top side */
          inset 1px 0px 3px #969393, /* inset left side */
          inset -1px 0px 3px #969393, /* inset right side */
          inset 0px -4px 3px #969393; /* inset bottom side */
        &:before {
          content: "Good Job!";
          color: indigo;
          text-shadow: -2px -1px white;
        }
      }
    }
    SCSS

    At this moment, you can witness 🧐 the active effect in action. Take a moment to observe and analyze how the effect is taking place and what impact it has. This will help you gain a better understanding of the process and its outcomes, which can be useful for future reference and decision-making. 😇 So, good luck with your work!

    Complete code solution

    Below is the full code referenced in this blog post. Feel free to copy and use it in your own projects. If you have any questions or encounter any issues, don’t hesitate to reach out for assistance. You can easily copy the desired code snippet by clicking on the copy icon, located in the top-right corner of each snippet.

    <div class="wrapper">
      <button class="custom-button"></button>
    </div>
    HTML
    body {
      background-color: darkgrey;
      height: 100vh;
      
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .wrapper {
      width: 500px;
      height: 140px;
      background: transparent;
      border-radius: 80px;
      box-shadow: inset 0px 3px 5px #c6c2c2,
        0px 5px 5px #727070;
    
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .custom-button {
      width: 460px;
      height: 100px;
      background: transparent;
      border-radius: inherit;
      box-shadow: inherit;
      border: none;
      font-family: 'Arial';
      font-size: 45px;
      color: #12528e; /* a shade of blue */
      font-weight: bold;
      display: flex;
      align-items: center;
      justify-content: center;
      &:before {
        position: absolute;
        content: "hover me";
        text-shadow: -2px -1px black;
      }
      &:hover {
        cursor: pointer;
        &:before {
          content: "click me";
        }
      }
      &:active {
        box-shadow: 0px -1px 3px #969393,  /* top side */
          inset 0px 5px 3px #b7b5b5, /* inset top side */
          inset 1px 0px 3px #969393, /* inset left side */
          inset -1px 0px 3px #969393, /* inset right side */
          inset 0px -4px 3px #969393; /* inset bottom side */
        &:before {
          content: "Good Job!";
          color: indigo;
          text-shadow: -2px -1px white;
        }
      }
    }
    SCSS
    Expand
  • How To Make A CSS Text Reflection Effect

    How To Make A CSS Text Reflection Effect

    Hi there! 😃 In this post, we’ll learn bit by bit how to create a CSS text reflection effect. When we say reflection, we’re referring to a mirror-like effect that looks like the text reflects on a surface, much like the way we see our reflection in a mirror.

    This is a simple yet amazing way to enhance the appearance of your text. Let’s analyze our effect so that you can easily follow along.

    HTML structure

    We will begin with our HTML structure. As you can see below, I prepared a div with the class .reflection-text , this is where our effect will take place.

    <div class="reflection-text">HELLO WORLD</div>
    CSS

    CSS foundation

    Let’s move forward with the CSS basic structure. We start with defining the background. It’s worth noting that using radial-gradient can make our effect more impressive. 😃

    body {
      background: radial-gradient(lightgreen, darkgreen);
      height: 100vh;
    }
    CSS

    Below, we can see the background we just created.

    In web development, we use the flex method in order to center our text. Then we will enhance its appearance, by making some adjustments. We will set the font-size to 100 pixels, select the “Roboto” font-family, and choose white as the text color.

    body {
      ...
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .reflection-text {
      font-size: 100px;
      font-family: 'Roboto', sans-serif;
      color: white;
    }
    CSS

    This is what is rendered on the screen for now. A perfectly centered, 🎯 white text.

    Adding the CSS structure for the reflection effect

    Creating a reflection can be achieved by using pseudoelements like :before and :after. To ensure this works properly, we need to include position: relative in our .reflection-text class.

    .reflection-text {
      ...
      position: relative;
    }
    CSS

    Now, we are ready to proceed and create our reflection by adding the :before pseudoelement with all the necessary properties, as shown in the following code snippet.

    .reflection-text:before {
      content: "HELLO WORLD";
      position: absolute;
      top: 65px;
      transform: rotate(180deg) scaleX(-1);
      background: linear-gradient(
        to bottom, 
        rgba(255, 255, 255, 0) 20%, 
        rgba(255, 255, 255, 0.5) 60%, 
        rgba(255, 255, 255, 2) 100%
      );
      background-clip: text;
      color: transparent;
      opacity: 0.3;
    }
    CSS

    Breaking down the process

    🟢 To begin, we add the text “HELLO WORLD” to create another text element with the same content. This new text will serve as our reflection. Then, we set position: absolute so that we can move our reflected text below the original text. We use the top property to move the reflected text 65 pixels from the top, but you can always move the reflection in any direction you prefer. It is important to position the text and its reflection closely together for a more realistic reflection effect. 😉

    🟢 We move forward and use the transform CSS property to rotate the text by 180 degrees

    and then flip it horizontally using scaleX(-1). Now we have the perfect reflection! Let’s continue and make it more realistic.

    🟢 In the next step, we will adjust the color of our reflected text. To achieve this, we will utilize the linear-gradient CSS property and specify the direction as downwards. This will create white gradients, with the top appearing more intense and gradually fading towards the bottom of the text.

    🟢 It is commonly known that gradients cannot be directly applied to texts. Don’t worry! 🤔 We already have the solution to this problem. For now, let’s give a quick explanation. To create a clipped linear background pattern for text, first, we add the -webkit-background-clip: text property, and at the same time, we set the color to transparent, and our text automatically turns to transparent. In that way, our text takes the background: linear-gradient as its real color.

    🟢 For a more transparent text, we can adjust the opacity. The lower the opacity, the more transparent our text becomes. So, here we are! Our reflection is ready! 🥳

    Exploring different colors

    🔖 It is always an option to use black or any other color in our work. Below, I’ve included examples of texts with black, purple, and green colors. It’s important to remember that the key factor is to set the correct gradients at the linear-gradient property. That way, we can create respective shades. Therefore, please give extra attention to that! 😊

    Black text

    .reflection-text {
      position: relative;
      font-size: 100px;
      font-family: 'Roboto', sans-serif;
      color: black; /* default color */
    }
    CSS
    .reflection-text:before {
      content: "HELLO WORLD";
      position: absolute;
      top: 65px;
      transform: rotate(180deg) scaleX(-1);
      background: linear-gradient(to bottom, 
      rgba(0, 0, 0, 0) 20%, 
      rgba(0, 0, 0, 0.5) 60%, 
      rgba(0, 0, 0, 2) 100%);
      background-clip: text;
      color: transparent;
      opacity: 0.3;
    }
    CSS

    Purple Text

    .reflection-text {
      position: relative;
      font-size: 100px;
      font-family: 'Roboto', sans-serif;
      color: purple;
    }
    CSS
    .reflection-text:before {
      content: "HELLO WORLD";
      position: absolute;
      top: 65px;
      transform: rotate(180deg) scaleX(-1);
      background: linear-gradient(to bottom, 
      rgba(255, 55, 205, 0) 20%, 
      rgba(255, 55, 205, 0.5) 60%, 
      rgba(255, 55, 205, 2) 100%);
      background-clip: text;
      color: transparent;
      opacity: 0.3;
    }
    CSS

    Green Text

    .reflection-text {
      position: relative;
      font-size: 100px;
      font-family: 'Roboto', sans-serif;
      color: green;
    }
    CSS
    .reflection-text2:before {
      content:"HELLO WORLD";
      position: absolute;
      top: 65px;
      transform: rotate(180deg) scaleX(-1);
      background: linear-gradient(to bottom, 
      rgba(20, 150, 20, 0) 20%, 
      rgba(20, 150, 20) 60%, 
      rgba(20, 150, 20, 2) 100%);
      background-clip: text;
      color: transparent;
      opacity: 0.3;
    }
    CSS
  • Gray vs Grey in CSS. What Is the Right Choice?

    Gray vs Grey in CSS. What Is the Right Choice?

    Gray VS grey? Is there a right choice between these two? It is well known that both gray and grey in CSS are considered equivalent with no impact on functionality. We can use either of them without any issues. In the context of web development and CSS, they are both recognized and accepted. CSS specifications and web browsers accommodate both equally.

    Why 🤔 do web designers and programmers use both gray and grey in CSS?

    Because they wanted to add a little color to the spelling debate!

    Below we can see an example of two elements. We set gray for the first element while the second element has grey:

    /* Using "gray" (American English) */
    .first-element {
      color: gray;
    }
    
    /* Using "grey" (British English) */
    .second-element {
      color: grey;
    }
    CSS

    Both examples are correct, and your CSS should be functional, .first-element and .second-element classes will share the same color, as CSS treats gray and grey interchangeably.

    It turns out that the choice between gray and grey in CSS is primarily a matter of personal preference and doesn’t affect how web browsers interpret your code. You are free to use either.

    Similarly, there are other color names with variations in spelling that are recognized by most modern browsers, for example, “lightgray” and “lightgrey” or “darkgray” and “darkgrey” are all valid. 😃

  • 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 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.

  • CSS Text Outline: How To Make Amazing Outlined Texts

    CSS Text Outline: How To Make Amazing Outlined Texts

    Hello, there 😃 Let’s step into a digital world where CSS brings forth the captivating CSS text outline effect. It’s a simple yet powerful technique that adds structure and clarity to texts and elements.

    Let’s dive into how CSS outlines 🖋 can make a significant difference in the visual appeal of your website. 💻 🫧

    Create basic HTML and CSS structure

    As a first step, we need some basic HTML structure to apply our CSS stylings.

    <body>
      <div class="outline-effect">outline effect</div>
    </body>
    HTML
    /* insert google fonts */
    @import url(
      'https://fonts.googleapis.com/css2?family=Emilys+Candy&display=swap'
    );
    
    body {
      background-color: purple;
    }
    
    .outline-effect {
      width: 650px;
      font-size: 180px;
      text-align: center;
      font-family: 'Emilys Candy', cursive;
    }
    CSS

    Let’s see what we have done so far. I have chosen a vibrant purple color for our background while keeping the text in the default black color. Our text is set to 180px, perfectly aligned to the center.

    To give a playful and lively vibe to our design, I’ve chosen the “Emily Candy” font-family which adds a delightful touch. If you also intend to use this font family, importing it into your CSS file is essential. Ensure the @import statement is placed at the beginning of your CSS code snippet, just like I did (check above lines 2-4).

    In the image below, you can see the current rendering on the screen up to this point.

    Apply the CSS text outline effect

    .outline-effect {
      ...
      text-stroke: 2px #8695e9; // medium blue shade
      color: transparent;
    }
    CSS

    The first thing we have to do is set the text-stoke property which represents a specific style line. Here, in our example, the text should have a light to medium blue color (#8695e9) outline with 2 pixels wide. Remember that as we increase the pixels, the outline becomes wider.

    🔖 It’s useful to know that we can split the text-stroke property in two: text-stroke-width and text-stroke-color.

    /* 1st choice */
      text-stroke: 2px #8695e9;
    
    /* 2nd choice */
      text-stroke-width: 2px;
      text-stroke-color:  #8695e9;
    CSS

    (Personally, I opt for the shortened form, saving time and extra lines of code, but the choice is yours. 🙂)

    Finally, by adding color: transparent we complete our effect by allowing the background to show through.

    To sum up, this code styles a piece of text with a see-through center and a visible 2px blue outline. It’s simple yet impressive 🎈 ✨

  • CSS Text Decoration Explained with Examples

    CSS Text Decoration Explained with Examples

    Hi to everyone 😃 Today, we will analyze the CSS text decoration property, which is a valuable tool for improving the presentation of text on your website. It allows us to add visual enhancements such as underlines for hyperlinks, strikethroughs for completed tasks, or the removal of decoration for a clean and professional appearance.

    With minor code adjustments to our CSS code, we can enhance the visual appeal of our text content. Consider integrating it to elevate the aesthetics of our website. Below, I’ve prepared a detailed guide.

    Wishing you bug-free reading 👩‍💻, I mean coding! 💻 ✨

    Text-decoration line

    First of all, we define the position of the line we desire by setting text-decoration-line. Those are: underline, overline, and line-through.

    text-decoration-line: overline;
    CSS
    CSS text decoration: An image showing the text-decoration-line: overline; CSS property.
    CSS text decoration: An image showing the text-decoration-line: underline; CSS property.
    text-decoration-line: underline;
    CSS
    /* text-decoration: line-through is also a way to write it */
    text-decoration-line: through;
    CSS
    CSS text decoration: An image showing the text-decoration-line: through; CSS property. (text-decoration: line-through is also a way to write it).
    CSS text decoration: An image showing the text-decoration-line: overline through underline; CSS property. That means we can make line combinations.
    /* we are also able to make line combinations */
    text-decoration-line: overline through underline;
    CSS

    Text-decoration style

    Next, we proceed by configuring text-decoration-style to specify the desired line style, such as solid, dashed, dotted, double, or wavy.

    🔖 Each example set a different position (text-decoration-line) for the lines as an opportunity to see more combinations. 😎

    text-decoration-line: through;
    /* default style */
    text-decoration-style: solid;
    CSS
    An image showing the text-decoration-style: solid; CSS property.
    An image showing the text-decoration-style: dashed; CSS property.
    text-decoration-line: underline;
    text-decoration-style: dashed;
    CSS
    text-decoration-line: overline;
    text-decoration-style: dotted;
    CSS
    An image showing the text-decoration-style: dotted; CSS property.
    An image showing the text-decoration-style: double; CSS property.
    text-decoration-line: double;
    text-decoration-style: double;
    CSS
    text-decoration-line: overline;
    text-decoration-style: wavy;
    CSS
    An image showing the text-decoration-style: wavy; CSS property.

    The amazing color property

    Using colors is a timeless strategy for enhancing aesthetics. Embracing the use of colors is equally effective in our case, accomplished through the addition of text-decoration-color.

    An image showing the text-decoration-color: black; CSS property, which is the default color.
    /* default color value */
    text-decoration-color: black;
    /* or */
    text-decoration-color: initial;
    CSS
    text-decoration-color: orange;
    CSS
    An image showing the text-decoration-color: orange; CSS property.
    An image showing the text-decoration-color: current-color; CSS property. This property inherits the text's color.
    .text-color {
      color: green;
    }
    /* inherits text's color */
    text-decoration-color: current-color;
    /* or */
    text-decoration-color: inherit;
    CSS

    An analytical post about colors 🌈 is now available if you are interested in expanding your knowledge of colors.

    Text-decoration thickness

    Lastly, adjusting the text-decoration-thickness allows us to precisely manage the thickness and also offers us the flexibility to choose between pixels (px) or percentages (%) based on our preferences.

    /* the browser pick the thickness of the text decoration line */
    text-decoration-thickness: auto;
    CSS
    CSS for text decoration: An image showing the text-decoration-thickness: auto; CSS property, which is the default thickness.
    CSS for text decoration: An image showing the text-decoration-thickness: initial; CSS property, which is the default thickness as determined by the browser.
    /*  means "use the default thickness for underlines as determined
     *  by the browser".
     */
    text-decoration-thickness: initial;
    CSS
     /* The percentage value is relative to the font size of the text
      *  to which the decoration is applied.
      *  Example:
      *  In our case the font size is set to 40 pixels,
      *  so the underline will be 6 pixels thick,
      *  which is 15% of its font size (15% of 40 pixels) 
      */
    text-decoration-thickness: 15%;
    CSS
    CSS for text decoration: An image showing the text-decoration-thickness: 15%; CSS property. That mean the thickness of our line will be 15% of the text's font-size.
    CSS for text decoration: An image showing the text-decoration-thickness: 10px; CSS property.
    /* override the applied default thickness */
    text-decoration-thickness: 10px;
    CSS
    <div class="parent">
      hello, I'm the parent
      <div class="child">hi, I'm the child</div>
    </div>
    HTML
    /* Thickness for the parent element */
    .parent {
      text-decoration: underline;
      text-decoration-style: solid;
      text-decoration-thickness: 20px;
    }
    
    /* Inherits thickness from the parent */
    .child {
      text-decoration-thickness: inherit;
    }
    CSS
    CSS for text decoration: An image showing that the child element inherits the parents thickness setting the text-decoration-thickness: inherit CSS property.

    Be distinctive by mixing text-decoration

    We can always create mixings and make our texts more strong and more stylish. Below I prepared two examples for you in order to make it clearer. 😃

    Underline mixings

    We combined the following HTML and CSS code snippets to create a styled text element. The HTML part consists of a <div> element with the class underline-mixings containing the text hello and a nested <span> element with the class extra-underline, also containing the text hello.

    <div class="underline-mixings">
      hello
      <span class="extra-underline">hello</span>
      hello
    </div>
    HTML
    .underline-mixings {
      text-decoration-line: underline;
      text-decoration-style: double;
      text-decoration-color: green;
    }
    .one {
      text-decoration-line: underline;
      text-decoration-style: dashed;
      text-decoration-color: red;
      text-decoration-thickness: 12px;
    }
    CSS

    The CSS styles are applied to these elements using their respective class selectors. The underline-mixingsins class applies an underline with a double style and green color to the text within the <div>.

    On the other hand, the extra-underline class applies a red dashed underline to the text within the <span>, along with a 12-pixel thickness for the underline.

    When combined, this code creates a styled text element where the text inside the <div> is underlined with a green double line, while the text inside the <span> has a red dashed underline with increased thickness. We can use it if we want to emphasize a specific part of a text.

    CSS for text decoration: An image showing that we are able to make mixing decorations.

    Strike through mixings

    Within the HTML code, there is a <div> element with the class strike-through-mixings, encompassing the text hello and containing a nested <span> element with the class extra-underline, which also contains the text hello.

    <div class="strike-through-mixings">
      hello
      <span class="extra-underline">hello</span>
      hello
    </div>
    HTML
    .strike-through-mixings {
      text-decoration-line: underline;
      text-decoration-style: solid;
      text-decoration-color: green;
    }
    .two {
      text-decoration-line: line-through;
      text-decoration-style: double;
      text-decoration-color: red;
      text-decoration-thickness: 8px;
    }
    CSS

    The CSS styles are assigned to these elements through their corresponding class selectors. The strike-through-mixings class gives the text within the <div> an underline with a solid style and a green color. Meanwhile, the extra-underline class applies a red double line-through decoration to the text inside the <span>, with an 8-pixel thickness.

    When we put together this code, generates a styled text element where the text within the <div> has a green solid underline, and the text within the <span> is displayed with a red double line-through decoration of increased thickness. It is really useful if we want to erase a part of a text.

    Text decoration CSS: An image showing that we are able to make mixing decorations.

    Text-decoration shorthand

    The CSS text-decoration shorthand property lets you apply decorations like underline, overline, and line-through in a single statement. It simplifies things by merging multiple properties into one. Settling the shorthand makes your code shorter and easier to understand. You can set all of these properties at once, making it more efficient or you can pick some of them based on your requirements.

    The CSS text-decoration shorthand property lets you apply decorations like underline, overline, and line-through in a single statement

    🔖 Note that the order of these values doesn’t matter; you can change the order and still achieve the same results. However, it is essential to specify the type of the line, as setting the text-decoration-line is a necessary step for your code to work properly.

    text-decoration: 10px dashed orange underline;
    CSS
    Text decoration CSS: An image showing showing the word 'Goodbye!' with the text-decoration: 10px dashed orange underline; CSS property.
  • HTML Formatting Elements Made Simple: With Easy And Practical Examples

    HTML Formatting Elements Made Simple: With Easy And Practical Examples

    We often format HTML elements using CSS but can achieve basic text formatting using only HTML. Below are some of the most common HTML formatting elements for text and layout. I also prepared some examples for better understanding.

    HTML Elements – Text Formatting

    bold

    <b>...</b>

    <div>I am a <b>bold</b> text</div>
    HTML
    HTML formatting elements: An image showing a purple box with the sentence 'I am a bold text'. The word bold is formatted in bold.

    strong

    <strong>...</strong>

    <div>I am a <strong>strong</strong> text</div>
    HTML
    An image showing a purple box with the sentence 'I am a strong text'. The word strong is formatted in strong.

    📢 Bold VS Strong

    As we can see below <bold> and <strong> look exactly the same. The difference is that we use strong when we have to show an important text and bold when we want just to pay attention to the text, something like highlighting.

    <div>I am a <b>simple</b> text BUT i am an <strong>important</strong> text!!</div>
    HTML
    An image showing a pink box with the sentence 'I am a simple text BUT I am an important text'. The word simple is formatted in bold and the word important is formatted in strong.

    italic

    <i>...</i>

    <div>I am an <i>italic</i> text</div>
    HTML
    An image showing a purple box with the sentence 'I am an italic text'. The word italic is formatted in italic.

    emphasized

    <em>...</em>

    <div>I am an <em>emphasized</em> text</div>
    HTML
    An image showing a purple box with the sentence 'I am an emphasized text'. The word emphasized is formatted in emphasized.

    📢 Italic VS Emphasized

    Formatting italic <i> and emphasized <em> appear in the exact same way. We use emphasized when we want to give emphasis to the text and italic when we want to present different our text.

    <div>I am an <i>italic</i> text BUT i am an <em>emphasized</em> text!!</div>
    HTML
    An image showing a pink box with the sentence 'I am an italic text BUT I am an emphasized text'. The word italic is formatted in italic and the word emphasized is formatted in emphasized.

    underline

    <u>...</u>

    <div>I am an <u>underline</u> text</div>
    HTML
    An image showing a purple box with the sentence 'I am an underline text'. The word underline is formatted in inderline.

    deleted

    <del>...</del>

    <div>I am a <del>deleted</del> text</div>
    HTML
    An image showing a purple box with the sentence 'I am a deleted text'. The word deleted is formatted in deleted.

    marked

    <mark>...</mark>

    <div>I am a <mark>marked</mark> text</div>
    HTML
    An image showing a purple box with the sentence 'I am a marked text'. The word marked is formatted in marked as hypertext.

    big

    <big>...</big>

    <div>I am a <big>big</big> text</div>
    HTML
    An image showing a purple box with the sentence 'I am a bid text'. The word big is formatted in big which means it has bigger font-size than the rest of the words.

    small

    <small>...</small>

    <div>I am a <small>small</small> text</div>
    HTML
    An image showing a purple box with the sentence 'I am a small text'. The word small is formatted in small which means it has smaller font-size than the rest of the words.

    superscript

    <sup>...</sup>

    <div>I am a superscripted text: a<sup>2</sup> X a<sup>2</sup> = a<sup>2 + 2</sup></div>
    HTML
    An image showing a purple box with the sentence 'I am a supscripted text: a2 X a2 = a2 + 2'. Number 2 are all formatted in superscripted.

    subscript

    <sub>...</sub>

    <div>I am a subscripted text: H<sub>2</sub>O</div>
    HTML
    An image showing a purple box with the sentence 'I am a subscripted text: H2O'. The number 2 is formatted in subscripted.

    HTML Elements – Layout Formatting

    We can use two tags in HTML to manipulate our document’s layout. Break Line tag <br/> which inserts a new line by adding the tag wherever we want to force the text to break and the Horizontal row tag <hr/> which is used if we want to add space between HTML elements.
    There are both self-closing tags as they are empty elements.

    break line

    <br>

    <div>This is a sentence which <br>forced to break in two lines!!</div>
    HTML
    An image showing a purple box with the sentence 'This is a sentence which forced to break in two lines'. The sentence is separated into two lines.

    💡 A common practice for adding a new line is using the break line tag, which is helpful If we want to write an address.

    <div>Jane Doe<br/>Champs-Élysées Avenue<br/>Paris - France</div>
    HTML
    An image showing a purple box with an adress. The adress is separated into three lines. Jane Doe in the first line Champs-Elysees Avenue in the second line and Paris-France in the third line.

    horizontal row

    <hr>

    <h2>Chapter 1</h2>
    <p>Here goes text for chapter 1</p>
    <hr/>
    <h2>Chapter 2</h2>
    <p>Here goes text for chapter 2</p>
    HTML
    This image shows how we separate two chapters with a horizontal row among them.

    💡 Remember, If you want to apply extra styling, you have to use 🔓 CSS instead! HTML is used as a markup language, whereas CSS is the one responsible for making something more beautiful 😄).