skip to Main Content

enter image description here

AS you noticed the gradient will start from
light blue -> white -> dark blue
top to bottom and there’s a glow effect

is this possible on CSS?

2

Answers


  1. @Mark Yes, it is indeed possible to create a gradient with a glow effect using CSS. You can get this by combining the linear-gradient property and the box-shadow property.

    Here is an example:

    body {
      margin: 0;
      height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
      background: linear-gradient(to bottom, #87CEEB, #ffffff, #00008B);
      box-shadow: 0 0 20px rgba(0, 0, 139, 0.5); /* Adjust the color and spread as needed */
    }
    
    /* Add other styles for your content */
    .content {
      color: white;
      font-size: 24px;
    }
    

    In this example:

    • The linear-gradient property is used to create a gradient that goes from lightblue (#87CEEB) to white to dark blue(#00008B) from top to bottom.

    Hope to be helpful for your coding.

    PS: If you just want to give that effect on border you can do like this:

    body {
      margin: 0;
      height: 100vh;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .border-container {
      width: 200px; /* Adjust the width as needed */
      height: 200px; /* Adjust the height as needed */
      border-width: 20px; /* Adjust the border width as needed */
      border-image: linear-gradient(to bottom, #87CEEB, #ffffff, #00008B) 1;
      border-image-slice: 20; /* Adjust the slice value to match the border width */
      box-shadow: 0 0 20px rgba(0, 0, 139, 0.5); /* Adjust the shadow properties as needed */
    }
    
    Login or Signup to reply.
  2. I add sample code below.

    @import url('//raw.githubusercontent.com/necolas/normalize.css/master/normalize.css');
    html {
      /* just for showing that background doesn't need to be solid */
      background: linear-gradient(to right, #DDD 0%, #FFF 50%, #DDD 100%);
      padding: 10px;
    }
    
    .grounded-radiants {
      width: 200px;
      height: 300px;
      position: relative;
      border: 1-px solid transparent;
      border-radius: 16px;
      background: #365DA8;
      background-clip: padding-box;
      padding: 5px;
      /* just to show box-shadow still works fine */
    }
    
    .grounded-radiants::after {
      position: absolute;
      top: -5px;
      bottom: -5px;
      left: -5px;
      right: -5px;
      background: linear-gradient(to bottom, #87CEEB, #ffffff, #00008B);
      content: '';
      z-index: -1;
      border-radius: 16px;
      box-shadow: 0 3px 9px black, inset 0 0 9px white;
    }
    <p class="grounded-radiants">
      Some text is here.<br/> There's even a line break!<br/> so cool.
    </p>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search