Remove border color from linear gradient - html

I've a problem removing a (border) color from a overlapping linear gradient. In IE 11 it workes as expected. In Firefox there is a small visible grey line between the gradients. How can I remove this?
I tried it this way:
.box2 {
background-image: -webkit-linear-gradient(154deg, red 67%, transparent 33%), -webkit-linear-gradient(26deg, transparent 67%, red 33%);
background-image: -moz-linear-gradient(154deg, red 67%, transparent 33%), -moz-linear-gradient(26deg, transparent 67%, red 33%);
background-image: -ms-linear-gradient(154deg, red 67%, transparent 33%), -ms-linear-gradient(26deg, transparent 67%, red 33%);
background-image: -o-linear-gradient(154deg, red 67%, transparent 33%), -o-linear-gradient(26deg, transparent 67%, red 33%);
background-image: linear-gradient(154deg, red 67%, transparent 33%), linear-gradient(26deg, transparent 67%, red 33%);
background-position: 0 0, 100% 0;
background-repeat: no-repeat;
background-size: 80% 100%;
height: 100px;
width: 100%;
border: 0;
}
Here's a fiddle:
https://jsfiddle.net/aam6roaf/

I can see the very same issue in Firefox v45.0.2 or Windows 10. While I have no idea why that line is appearing, it goes away when I set the color-stop points like in the below snippet. Setting color stops like in the below snippet also has the advantage of producing smoother angled gradients.
This works well in Firefox v45.0.2, Chrome(v51.0.2704.19 dev-m), Opera v36, IE11 and Edge.
.box2 {
background-image: linear-gradient(154deg, red 67%, transparent 67.25%), linear-gradient(26deg, transparent 67%, red 67.25%);
background-position: 0 0, 100% 0;
background-repeat: no-repeat;
background-size: 80% 100%;
height: 100px;
width: 100%;
border: 0;
}
<div class="box2"></div>

Related

Meter -- Change colours

Edit: the code has been changed to my answer.
Is it possible to change the 'grey' background colour in the meter?
I can change the 'progress bar' colour to red, but cannot change the 'grey background colour'.
I would like to have the meter display two colours, red and blue. Is this possible?
Many thanks,
/* Changes the 'progress bar' colour */
meter::-webkit-meter-bar {
background: none; /* Required to get rid of the default background property */
background: red;
}
/* Changes the 'background' colour */
meter::-webkit-meter-optimum-value {
background: blue;
}
<meter value="0.3"></meter>
Please Check once. Hope it helps.
meter::-webkit-meter-bar {
background: none; /* Required to get rid of the default background property */
background-color: whiteSmoke;
box-shadow: 0 5px 5px -5px #333 inset;
}
meter::-webkit-meter-optimum-value {
box-shadow: 0 5px 5px -5px #999 inset;
background-image: linear-gradient(
90deg,
#8bcf69 5%,
#e6d450 5%,
#e6d450 15%,
#f28f68 15%,
#f28f68 55%,
#cf82bf 55%,
#cf82bf 95%,
#719fd1 95%,
#719fd1 100%
);
background-size: 100% 100%;
}
<meter max="120" value="55.93" title="GB"></meter>

How to achieve the effect (shown in the attached image) in CSS

I would like to achieve the following effect in a div box. What CSS would do the trick? Thank you in advance for your answers!
Using the linear-gradient function in CSS3, the code will be +- like this:
.box{
height: 100px;
width: 100px;
background: linear-gradient(to top, blue, white, blue)
}
as stated in the first answer, use css gradients, and combine with border-radius for your rounded corners.
.box{
height: 200px;
width: 150px;
background: linear-gradient(to top, #4690ff, #ffffff, #4690ff);
border-radius:15px 0px 0px 15px;
}
<div class="box"></div>
You can use CSS3 with linear gradient. Something like this:
.demo {
width: 150px;
height: 150px;
}
.gradient {
background: #508cf4; /* Old browsers for fallback */
background: linear-gradient(to bottom, #508cf4 0%, #ffffff 50%, #508cf4 100%);
}
<div class="gradient demo"></div>
You could also google for "css3 gradient generator" to have a GUI. For example cssgradient.io
You might test run a few css gradient tools like ColorZilla and GradientFinder to work with gradient colors.
Also, by combining a low opacity radial gradient with a linear gradient you can get a more rich look that might get closer to your original image.
.box {
display: block;
width: 182px;
height: 229px;
background:
radial-gradient(ellipse at center, rgba(252,253,255,.2) 54%,rgba(212,229,255,.2) 66%,rgba(212,229,255,.2) 66%,rgba(153,193,255,.2) 79%,rgba(153,193,255,.2) 79%,rgba(57,136,255,.2) 100%),
linear-gradient(to top, rgb(57, 136, 255) 0%, rgb(153, 193, 255) 13%, rgb(212, 229, 255) 23%, rgb(252, 253, 255) 43%, rgb(252, 253, 255) 57%, rgb(212, 229, 255) 77%, rgb(153, 193, 255) 87%, rgb(57, 136, 255) 100%);
border-radius: 16px 0 0 16px;
}
<div class="box"></div>
<p>original <img src="https://i.stack.imgur.com/OJ5Z6.png" /></p>

1px wide diagonal stripes with gap between in CSS

I am tried to do something in CSS, but I failed miserably.This is what I got so far:
#stripes {
height:90vh;
background-image: linear-gradient(-45deg, black 25%, transparent 25%, transparent 50%, black 50%, black 75%, transparent 75%, transparent);
background-size:4px 4px;
}
<div id="stripes"></div>
As you can see, the "black-white-ratio" is always the same. So you got a 1px stripe, then a 1px gap, 1px stripe, 1px gap,...But what I am trying to achieve, is that there are like 5px space between the stripes.I tried changing the percentages, but that doesn't result in what I try to do either.I'm sure this is possible somehow. Does anyone know how? Thanks for your help!
Something like this using repeating-linear-gradient
#stripes {
height: 100vh;
background: repeating-linear-gradient( -45deg, transparent, transparent 5px, /* gap */
black 6px, /* overall width incluing gap */
black 6px);
}
* {
margin: 0;
padding: 0;
}
<div id="stripes"></div>

CSS Parallelogram-Cut Border Pattern

I would like insight as to whether or not it is possible to develop a border pattern like the one displayed here through CSS code. I've considered making the pattern through a Photoshop-like program and then setting the background of the border to the url of the photoshop-made pattern. How I run into browser compatibility issues if I wish to pursue this through coding?
Able to make a pretty similar border using straight css.
First, in before, generated a box with 3 striped lines- one red, one blue, one beige. Also added the beige border to this.
Then, in the :after pseudo element, just gave the box a beige background (probably could look better with a gradient background too).
Check it out:
<!DOCTYPE html>
<html>
<head>
<style>
p.box:before{
content: '';
position: absolute;
z-index: -1;
width: 100%;
height: 100%;
background:repeating-linear-gradient(
45deg,
hsl(60, 56%, 81%) 0px,
hsl(60, 56%, 81%) 4px,
red 5px,
red 14px,
hsl(60, 56%, 81%) 15px,
hsl(60, 56%, 81%) 20px,
hsla(247, 83%, 37%, 1) 21px,
hsla(247, 83%, 37%, 1) 30px
),
linear-gradient(
to bottom,
rgba(48, 26, 255, 1),
rgba(85, 66, 255, 1)
);
border: 5px solid hsl(60, 56%, 81%);
}
p.box:after{
content: '';
position: absolute;
right: -.5%;
bottom: -2.5%;
background: hsl(60, 56%, 81%);
z-index: -1;
height: 97%;
width: 97%;
}
</style>
</head>
<body>
<p class="box"></p>
</body>
</html>

Create CSS header with centered logo, and lines that extend out from the right/left of transparent PNG

I've been trying to create this look:
What I thought was a clever way of doing it was to create an unordered list, have the bars on the left/right use 100% of the width not taken by the logo.
Apparently, I've failed at this.
The site in question is live, and you can visit it here (to see the code I've created so far): http://amydemosphotography.smugmug.com/galleries
I've not been able to make the bars and the logo occupy the same vertical space, and I haven't been able to solve the issue of how to make them grow/shrink with the browser window while allowing the logo to 1) always stay cenetered, and 2) always have padding on the left/right (so the lines don't ever touch/go under it).
What am I doing wrong?
Here is how I would do it:
<h1><img src="http://cdn.smugmug.com/photos/2254208423_RS5b5Z6-O.png" alt="Logo"></h1>
--
body {
padding-top: 3em;
}
h1 {
color: #333;
display: table;
}
h1:after,
h1:before {
background-image: -webkit-linear-gradient(transparent 40%, #87a 40%, #87a 60%, transparent 60%);
background-image: -moz-linear-gradient(transparent 40%, #87a 40%, #87a 60%, transparent 60%);
background-image: -ms-linear-gradient(transparent 40%, #87a 40%, #87a 60%, transparent 60%);
background-image: -o-linear-gradient(transparent 40%, #87a 40%, #87a 60%, transparent 60%);
background-image: linear-gradient(transparent 40%, #87a 40%, #87a 60%, transparent 60%);
content: '';
display: table-cell;
width: 50%;
/* Everything below allows us to have a little bit of space between the title and the decoration */
-webkit-background-clip: padding;
-moz-background-clip: padding;
background-clip: padding;
}
h1:after {
border-left: 1.5em solid transparent;
}
h1:before {
border-right: 1.5em solid transparent;
}
​
And here is a live example: http://jsfiddle.net/joshnh/XjXYE/