This question already has answers here:
How wide is the default `<body>` margin?
(4 answers)
How to remove the stripes that appears when using linear gradient property [duplicate]
(2 answers)
Closed 11 months ago.
I'm having a trouble with gradient css.
for some reason when gradient finish i see the start gradient in a small line at the end.
html , body{
height: 100%;
width: 100%;
}
body{
font-family:Arial, Helvetica, sans-serif ;
background: #bef5f5; /* this is to make sure if one of the browsers arent going to read the gradient, so this is a backup background color */
background: -moz-linear-gradient(top, #833ab4 0%, #fd1d1d 50%, #cc640e 100% );
background: -webkit-linear-gradient(top, #833ab4 0%, #fd1d1d 50%, #cc640e 100% );
background: linear-gradient(top, #833ab4 0%, #fd1d1d 50%, #cc640e 100% );
}
.designHeader{
color: #ffffff;
}
.full{
height: 100% ;
width: 100%;
}
.mainFooter{
margin: 100 px;
background-image: url("pexels-pok-rie-268261.jpg");
}
Related
This question already has answers here:
Shape with a slanted side (responsive)
(3 answers)
Closed last month.
I am trying to draw curve in html and css. I tried but not able to draw it correctly, Could someone please help me. I will attach a picture which I am trying to achieve.
Thanks
.box {
width: 500px;
height: 100px;
border: solid 5px #000;
border-color: #000 transparent transparent transparent;
border-radius: 50%/100px 100px 0 0;
}
HTML
<span class="styling">Ali Haider</span>
CSS
.styling {
border:none;
background:green;
color:white;
padding:15px 40px;
text-transform:uppercase;
cursor:pointer;
clip-path: polygon(0 0, 100% 1%, 80% 100%, 0% 100%);
}
This question already has answers here:
How can apply multiple background color to one div
(8 answers)
Generate solid colors using CSS linear-gradient (not smooth colors)
(3 answers)
Closed 1 year ago.
.heading {
background-color: #FFC20E;
font-size: 23px;
font-weight: 600;
padding: 5px 0px 5px 22px;
font-family: "Open Sans";
}
<h3 class="heading">Heading</h3>
I have a heading with 3 background color, how do I do please suggest, for reference I attached image, please help
You can use CSS gradient for this. To include a solid, non-transitioning color area within a gradient, include two positions for the color stop. Color stops can have two positions, which is equivalent to two consecutive color stops with the same color at different positions. Here for more information
.heading{
padding:2px;
background: linear-gradient(to left,
#fffb0e 25%, #ffe30e 25% 50%, #FFC20E 50% 100%);
}
<h3 class="heading">Heading</h3>
Use CSS gradient
.heading {
background: #fcc601;
background: -moz-linear-gradient(left, #fcc601 0%, #fcc601 46%, #ffdb71 46%, #ffdb71 73%, #fff0c5 73%, #fff0c5 100%);
background: -webkit-linear-gradient(left, #fcc601 0%,#fcc601 46%,#ffdb71 46%,#ffdb71 73%,#fff0c5 73%,#fff0c5 100%);
background: linear-gradient(to right, #fcc601 0%,#fcc601 46%,#ffdb71 46%,#ffdb71 73%,#fff0c5 73%,#fff0c5 100%);
font-size: 23px;
font-weight: 600;
padding: 5px 0px 5px 22px;
font-family: "Open Sans";
}
<h3 class="heading">Heading</h3>
You could define a CSS gradient with sharp colour boundaries for the background as
eg: background: -webkit-linear-gradient(left, grey, grey 30%, white 30%, white);
But only a few browsers support that at the moment
See also http://www.webkit.org/blog/1424/css3-gradients/ for an explanation CSS3 gradients, including the sharp colour boundary trick.
.heading {
font-size: 23px;
font-weight: 600;
padding: 5px 0px 5px 22px;
font-family: "Open Sans";
background: linear-gradient(to right,
#ffe30e 50%, #fffb0e 33% 80%, #FFFF8A 33% 100% );
}
<h3 class="heading">Heading</h3>
You can create a div and inside that div, place three spans with a unique background to them and appropriate widths. Now, In the 1st span place your h3 tag.
Here's the code,
HTML ->
<div id="heading-div">
<span id="span1">
<h3>Heading</h3>
</span>
<span id="span2"></span>
<span id="span3"></span>
</div>
CSS ->
#heading-div{
display: flex;
}
#span1{
width: 50%;
background-color: #feab1e;
}
#span2{
width: 25%;
background-color: #ff8059;
}
#span3{
width: 25%;
background-color: #fff;
}
This question already has answers here:
Is there a way to interpolate CSS variables with url()?
(4 answers)
Closed 4 years ago.
I need to pass an image to the CSS background like this it works:
.tinted-image {
height: 125px;
background: linear-gradient(to right, var(--color), var(--color2)),
url(https://static-cdn.jtvnw.net/ttv-boxart/Apex%20Legends-300x400.jpg);
}
but when I try to do it like this, I get a syntax error in VS Code
.tinted-image {
height: 125px;
background: linear-gradient(to right, var(--color), var(--color2)),
url(var(--url));
}
You can use it like the following:
:root {
--color: rgba(255, 0, 0, 0.5);
--color2: rgba(0, 255, 0, 0.5);
--url: url(https://static-cdn.jtvnw.net/ttv-boxart/Apex%20Legends-300x400.jpg);
}
.tinted-image {
height: 125px;
background: linear-gradient(to right, var(--color), var(--color2)), var(--url);
width: 200px;
}
<div class="tinted-image"></div>
CSS variables doesn't work on Internet Explorer. You can find all browsers with CSS variable support here: https://caniuse.com/#feat=css-variables
I'm trying to achieve a rectangle button with a transparent mask over the bottom right, as per this fiddle:
http://jsfiddle.net/c6gUX/
body {
background: #fff;
padding: 5em;
}
.button {
color: #FFFFFF;
font-family: 'RalewayRegular', Arial,sans-serif;
font-size: 1em;
padding: 0.5em 1.2em 0.5em 0.8em;
position: relative;
text-decoration: none;
}
.button:hover {
background: linear-gradient(to bottom, #FFA13E 0px, #E56204 100%) repeat scroll 0 0 transparent;
color: #FFFFFF;
}
.button:after {
background: url(http://i.imgur.com/8Vvw1Sw.png) no-repeat scroll 0 0 transparent;
bottom: -12px;
content: " ";
height: 38px;
position: absolute;
right: -12px;
width: 36px;
z-index: 99;
}
.orange-grad {
background: #ffa13e; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZmYTEzZSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZjc4MDUiIHN0b3Atb3BhY2l0eT0iMSIvPgogICAgPHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjZmY3ODA1IiBzdG9wLW9wYWNpdHk9IjEiLz4KICA8L2xpbmVhckdyYWRpZW50PgogIDxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIGZpbGw9InVybCgjZ3JhZC11Y2dnLWdlbmVyYXRlZCkiIC8+Cjwvc3ZnPg==);
background: -moz-linear-gradient(top, #ffa13e 0%, #ff7805 100%, #ff7805 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffa13e), color-stop(100%,#ff7805), color-stop(100%,#ff7805)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffa13e 0%,#ff7805 100%,#ff7805 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffa13e 0%,#ff7805 100%,#ff7805 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffa13e 0%,#ff7805 100%,#ff7805 100%); /* IE10+ */
background: linear-gradient(to bottom, #ffa13e 0%,#ff7805 100%,#ff7805 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffa13e', endColorstr='#ff7805',GradientType=0 ); /* IE6-8 */
}
As you can see, i've achieved it with a quite hacky way. I've untested this cross-browser and suspect IE to mess it up without a shim for :after, etc.
How can I achieve this cross-browser modern? How can I make it work when overlayed onto an image so it's effectively transparent? (See below image)
From PSD:
My fiddle on an image:
Logically I know that IE6/7 will need an image and i'm kinda OK with that.
Word length. Sometimes the button doesn't have 'Read more', so need a 100% width solution.
Edit
I am thinking of using a Sprite. (http://i.imgur.com/z0UYpTX.png)
This is tricky - particularly with your combination of a gradient with the beveled corner. The closest I could get is this fiddle, which makes use of CSS gradients to achieve the effect you're after, based on Lea Verou's awesome article.
The relevant CSS is:
.button {
background: #ffa13e; /* fallback */
background: -webkit-linear-gradient(135deg, transparent 10px, #ff7805 10px, #ffa13e 100%);
background: -moz-linear-gradient(135deg, transparent 10px, #ff7805 10px, #ffa13e 100%);
background: -o-linear-gradient(135deg, transparent 10px, #ff7805 10px, #ffa13e 100%);
background: linear-gradient(315deg, transparent 10px, #ff7805 10px, #ffa13e 100%);
}
That's the only way to get the background image to show through (that I know of). The drawback is that the gradient is not your linear one from top to bottom, but at an angle. I don't think it's possible to combine multiple gradients to match your visual precisely. But it is pretty close:
I'd suggest that this is the perfect candidate for progressive enhancement - older IE will get a solid background colour but that's perfectly acceptable (i.e. I wouldn't personally bother trying for an image fallback).
Note: there have been numerous changes between the Working Draft and the Candidate Recommendation for the gradient syntax, one of which is the angle of the gradient:
From the IE Blog. Hence the unprefixed version requires a different deg value.
Make use of it..... I think this will help You.. use it with ur image.. this will solve cross-browser issue...
http://jsfiddle.net/Praveen16oct90/2bZAW/1095/
div {
width:200px;
height:80px;
background: red;
top:150px;left:100px;
position: relative;
}
div:before {
content: '';
position: absolute;
top: 40px; right: 0;
border-right: 40px solid white;
border-top: 40px solid red;
width: 20;
}
I have a button with a background-image property that sets 1) an icon for the button and 2) a CSS3 background gradient. I would now like to override the background gradient further down the page, so the icon remains the same and I can create many button colours by simply overriding the background gradients.
Is there currently a way to override a specific layer of a multiple background property?
http://gard.me/1ulmH
HTML:
<a class="newButton blue" href="#">hello world</a>
CSS:
.newButton /* Orange by default */
{
margin: 20px;
display: inline-block;
padding: 12px 20px;
background: none;
background-repeat: no-repeat;
background-position: 9px 5px;
background-position: 9px 5px, 0 0;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
border-width: 1px;
border-style: solid;
font-family: Verdana, Arial, Sans-Serif;
text-decoration: none;
text-align: center;
/* Orange stuff */
color: #FFECEA;
border-color: #A03E33;
background-position: 0 0;
background-color: #E46553;
background-image: url('http://www.waveclothing.co.uk/media/Shopping%20Cart.png'), -o-linear-gradient(bottom, #D15039 0%, #F27466 100%);
background-image: url('http://www.waveclothing.co.uk/media/Shopping%20Cart.png'), -moz-linear-gradient(bottom, #D15039 0%, #F27466 100%);
background-image: url('http://www.waveclothing.co.uk/media/Shopping%20Cart.png'), -webkit-linear-gradient(bottom, #D15039 0%, #F27466 100%);
background-image: url('http://www.waveclothing.co.uk/media/Shopping%20Cart.png'), -ms-linear-gradient(bottom, #D15039 0%, #F27466 100%);
background-image: url('http://www.waveclothing.co.uk/media/Shopping%20Cart.png'), -webkit-gradient(linear, left bottom, left top, color-stop(0, #D15039), color-stop(1, #F27466));
}
.newButton.blue { /* Blue */ /* Here I need to overwrite the button background colour */
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #0B3661), color-stop(1, #0E4479));
}
enter code hereYou need to give it the full image usage just like the original definition, because the new definition is going to overwrite the whole background. So
.newButton.blue {
background-image: url('http://www.waveclothing.co.uk/media/Shopping%20Cart.png'), -webkit-gradient(linear, left bottom, left top, color-stop(0, #0B3661), color-stop(1, #0E4479));
}
Updated:
If you really want to individually switch the gradients, then you need to either put a span element in the a tag to place your icon image into and set that background independently on the icon (span) and gradient (a) OR since the gradients are new browser technology, do those on a :before or :after pseudoelement set to sit below the a tag. Something like:
a {
position: relative;
z-index: 1;
...icon related background code here...
}
a:after {
content: '';
display: block;
position: absolute;
z-index: -1;
top: 0;
bottom: 0;
left: 0;
right: 0;
...gradient related background code here...
}
EDIT: Note, as I reread your original question, it appears you may want the gradient above the icon. If so, you need to swap the background code for what I gave above.
When you set a new value for "background-image" it fully overrides its previous definition. Only the last definition applied will prevail.
I suggest you include the icon url for every background-image definition.