CSS Background Image Linear Gradient showing unwanted border in Chrome

rory

I'm using a background image with linear gradient to create a highlight text effect but it's causing an unwanted bottom border:

.fancy-underline {
    text-decoration: none;
    background-image: -webkit-gradient(linear,left top, left bottom,from(rgba(255,255,255,.7)),to(rgba(255,255,255,.7))),-webkit-gradient(linear,left top, left bottom,from(#91c678),to(#91c678));
    background-image: linear-gradient(rgba(255,255,255,.7),rgba(255,255,255,.7)),linear-gradient(#91c678,#91c678);
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 100% 50%;
}
<p><span class="fancy-underline">here is some fancy underline</span></p>

I can't see anything under the computed styles in the debugger that might cause this so I'm thinking it must be an issue with my linear gradient. Can anyone point me in the right direction?

Temani Afif

You can cover more area like below. You make the gradient big enough and you shift it to uncover the top 50% and you will have the same result as you did

.fancy-underline {
    text-decoration: none;
    background-image: linear-gradient(rgba(255,255,255,.7),rgba(255,255,255,.7)),linear-gradient(#91c678,#91c678);
    background-position: 0 -50%;
    background-repeat: no-repeat;
    background-size: 100% 200%;
}
<p><span class="fancy-underline">here is some fancy underline</span></p>

Related question to understand how it works: Using percentage values with background-position on a linear-gradient


A zoomed version to better see:

.fancy-underline {
  text-decoration: none;
  font-size:100px;
  background-image: linear-gradient(rgba(255, 255, 255, .7), rgba(255, 255, 255, .7)), linear-gradient(#91c678, #91c678);
}
.new {
  background-position: 0 -50%;
  background-size: 100% 200%;
  background-repeat:no-repeat
}

.old {
  background-position: 0 100%;
  background-size: 100% 50%;
  background-repeat:no-repeat
}
<span class="fancy-underline new">new</span>
<span class="fancy-underline old">old</span>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Background border radius with linear gradient

How to create semi transparent linear gradient background and border using css?

How to combine Background Image + Linear Gradient in CSS ? Linear Gradient over the Background Image

Unwanted duplication with gradient background in CSS

css "background-image" shows unwanted border, img "src" does not

Unwanted whitespace in -webkit-linear-gradient in Chrome

Unwanted Border CSS (Chrome & Firefox)

CSS - Change background image without affecting linear gradient?

CSS gradient border not showing correctly

Border shifting linear-gradient background

CSS nav bar with linear gradients not showing background in Chrome

Firefox and border-image with a linear gradient

Can Linear Gradient be used as the color of the border of an image

Is it possible to set border-image and background both with repeating-linear-gradient property?

HTML CSS Border Linear Gradient Corners

CSS Transition with Border Radius and Linear Gradient

Transparent Border showing background image

Image is not showing with the linear-gradient when parent has a background-color

CSS make my background statrs with color and end with another (similar) color background-image: linear-gradient

Gradient colour with Linear Gradient Border in text using css not working

background image linear gradient not working on navbar

Section background image and linear gradient not working

Linear gradient combined with image background not displaying

Linear gradient is not able to give overlay to background of image

Linear-gradient not covering entire background image

Linear gradient zig zag background image

CSS Linear Gradient Showing wrong word

blurred linear gradient background to solid color Css

Css background: offset for repeating-linear-gradient