linear-gradients

Fill an SVG shape with a gradient

穿精又带淫゛_ 提交于 2019-12-03 13:18:49
问题 How can I apply Linear gradient and drop shadow to this pattern? <svg viewbox="0 0 60 10"> <pattern x="-8" id="waves" patternUnits="userSpaceOnUse" width="10" height="10"> <path d="M0 10 V5 Q2.5 3.5 5 5 T10 5 V10" fill="#FFC338" /> </pattern> <rect x="0" y="0" width="60" height="7" fill="url(#waves)" /> </svg> 回答1: As commented by Paul LeBeau, you need to convert the wavy shape to one path, then you can fill the wavy shape with a linear gradient as shown in this example: <svg viewbox="7.5 0

Get color value of specific position in colorbar with gradient

风流意气都作罢 提交于 2019-12-03 08:20:13
I generated a gradient colobar with CSS3 styles ( fiddle ) and now want the color value of a specific location (by x and y coords) in that colorbar. As far as I know there is no direct way to do that. I see two options: Implement the gradient algorithm in JavaScript and calculate the value from scratch. Is there an exact definition how that algorithm works for multiple colors? Does the gradient look the same in every browser? Use a canvas and createLinearGradient method to draw the gradient and access the canvas directly to get the color value. Any other options? I chose to implement your

HTML table cell partial background fill

好久不见. 提交于 2019-12-03 06:45:09
I have a table that has a column that shows a % value. To make it more visually appealing, I'd like to display a linear gradient background that corresponds to the % value (e.g. 50% would fill half of the width of the cell). I figured out how to make gradient background (using ColorZilla's gradient generator) but don't know how to set the width of the background fill.... Current code: <table border="1" cellpadding="0" cellspacing="0"> <tr> <td width="100" style="background: linear-gradient(to right, rgba(0,150,0,1) 0%,rgba(0,175,0,1) 17%,rgba(0,190,0,1) 33%,rgba(82,210,82,1) 67%,rgba(131,230

Converting a SASS If/Else block to its equivalent in Less

北慕城南 提交于 2019-12-02 13:21:53
问题 There is a little SASS to LESS convergence here... Does anyone know what is the correct syntax for these? The code below is the pure SASS mixins I used to use. Thanks for helping @mixin linear-gradient($left, $right, $optional:false) { @if $optional and type_of($optional) == number { background: -webkit-linear-gradient($optional + deg, $left, $right); background: -o-linear-gradient($optional + deg, $left, $right); background: -moz-linear-gradient($optional + deg, $left, $right); background:

Stripes Border like sample image css

◇◆丶佛笑我妖孽 提交于 2019-12-02 07:23:07
I want to create a striped border. I want to use the img tag or div tag to include the image on top of the Striped Border. This is how it needs to look like: Now I am trying like this with border image as svg. .feed-item:after { background: #0055b9; background: url(../images/studentslab_hover_stripe_bg.svg); background-repeat: no-repeat; background-size: 100% 100%; padding: 4vw 2.7vw 2vw 2vw; width: 104%; opacity: 0; } .feed-item:hover:after { opacity: 1; z-index: -1; } But in responsiveness, it's not covering full sometimes because my striped background image has dimension height and width.

Converting a SASS If/Else block to its equivalent in Less

ぐ巨炮叔叔 提交于 2019-12-02 06:37:05
There is a little SASS to LESS convergence here... Does anyone know what is the correct syntax for these? The code below is the pure SASS mixins I used to use. Thanks for helping @mixin linear-gradient($left, $right, $optional:false) { @if $optional and type_of($optional) == number { background: -webkit-linear-gradient($optional + deg, $left, $right); background: -o-linear-gradient($optional + deg, $left, $right); background: -moz-linear-gradient($optional + deg, $left, $right); background: linear-gradient($optional + deg, $left, $right); } @else { @if $optional == "right" { background:

How to do equivalent of a linear-gradient with opacity on a seamless background image in CSS

蓝咒 提交于 2019-12-01 22:39:03
问题 I want to do this essentially in CSS: div { background: linear-gradient(to top, rgba(255,0,0,0), rgba(255,0,0,1), rgba(255,0,0,0)); width: 1000px; height: 1000px; } <div>hello</div> But instead of a color , I want to gradient-fade-in-and-out a background image, like this: background: linear-gradient(to top, transparent, url(/myimage.png) repeat, transparent); How to accomplish this in CSS, or if it's not possible in CSS, in JS. My image is a seamless texture, so maybe that might factor into

How to do equivalent of a linear-gradient with opacity on a seamless background image in CSS

谁说我不能喝 提交于 2019-12-01 21:15:55
I want to do this essentially in CSS: div { background: linear-gradient(to top, rgba(255,0,0,0), rgba(255,0,0,1), rgba(255,0,0,0)); width: 1000px; height: 1000px; } <div>hello</div> But instead of a color , I want to gradient-fade-in-and-out a background image, like this: background: linear-gradient(to top, transparent, url(/myimage.png) repeat, transparent); How to accomplish this in CSS, or if it's not possible in CSS, in JS. My image is a seamless texture, so maybe that might factor into the equation since it is repeated. I also want to set the background-size to different sizes to figure

Background animation performance

99封情书 提交于 2019-12-01 20:44:25
问题 I'm trying to create content loader but got a performance problem with background animation. It's smooth when there are only a few elements on the screen but dramatically drops fps while increasing stub elements count to 20-30. Now I know that animating background-position property is a bad idea and it is better to use transforms for this. but how can I do this? I'd like to keep seamless animation. Gradient should be relative to screen, not to container. Here is some code: const cardsRoot =

Why does the background turn white when I add a absolute position element?

旧时模样 提交于 2019-12-01 20:04:06
I made a gradient background and I want to centralize this block of text. My objetive is to create a header that centralizes in the middle of the screen no matter the resolution of the viewport. So I made this header an absolute position and used this centralization method I found online. It centralized perfectly, the problem is, the gradient background turns white (looks like the header is above the background on the body, I don't know). I've already tried using position fixed, but the problem persists, other types of position don't centralize. * { margin: 0px; padding: 0px; } body {