On my homepage (https://howtogetrippedathome.com/), I want to give all the (now) red elements a gradient color.
I managed to give the menu items, the service titles and service icons gradient colors using the following CSS:
.service-icon.wow.zoomInDown {
background: linear-gradient(to bottom right, #ff2828 , #F27B26) !important;
}
.service-title {
background: -webkit-linear-gradient(bottom left, #ff2828 , #F27B26);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
However, I was not able to make the text-decoration (double underscore) of the widget titles, the read my story/see all blogs buttons and the social icons (Facebook and Instagram) this gradient. Using 'linear-gradient' after 'color:' does not work unfortunately.
Is this doable, or am I asking for something impossible? I'm curious what you guys have to say.
Best,
Maarten
The closest I got to it for the double underline was this (see https://howtogetrippedathome.com/):
.widget-title:after {
background-image: -webkit-linear-gradient(left, #ff2828 , #F27B26);;
padding: 1px;
border-bottom: 6px double #fff !important;
}
However, this has the effect that there still is a white double border visible in the about section. Setting the color of the border to transparent results in both the border and the padding having the gradient color, so they form one rectangular shape.
Another way it could be done is using:
-webkit-border-image: -webkit-gradient(...)
But I can't make it work.
Any ideas?
For gradient text you can do something like this:
background: -webkit-linear-gradient(#eee, #333);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
Source: https://css-tricks.com/snippets/css/gradient-text/
For the double underline the best option you have is to use <hr> and set a gradient background.
There is a text-decoration-color style, but it doesn't accept gradients.
Related
I am using gradient text color for my links on hover, however a strange jump effect is occurring ever since I added the css class. Whenever I hover the link it jumps like 2px-4px up.
When I remove the gradient color class all is normal again. Is there any fix to this? The custom code I added:
.bg-gradient-ligth {
background-color: $white;
background-image: linear-gradient(315deg, $white 0%, $ligth-grey 74%);
}
a {
color:$green
}
a:hover {
background: -webkit-linear-gradient($gradient1, $gradient2);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.heading-gradient {
background: -webkit-linear-gradient($gradient1, $gradient2);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
The rest is just plain Bootstrap and theme CSS. Which worked fine before. By the way it also cuts off the text of a gradient h1 title at the bottom.
I have a photoshop design that has a heading color #524a48.
On the photoshop design there is a gradient-overlay on the text
h1 {
color: #524a48;
background: linear-gradient(to right, rgba(255,239,223, 0) 0%, rgba(255,239,223, 1));
opacity: 40%;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
So the overlay gradient from opacity 0 - 1. When using this code here the color of #524a48 doesn't show and I have a half transparent line of text...
Using #524a48 as the webkit-text-fill-color value completely hides my gradient.
How can I have color overlay over the color of my text using css?
Also how can I ensure that a fallback for this? So browsers that aren't chrome or safari will see #524a48. Is passing #524a48 to the color property sufficient?
Thank you in advance
You should be able to make a solution with this
You just need to edit all the alpha layer values
h1 {
font-size: 72px;
background: -webkit-linear-gradient(0deg, rgba(255,239,223, 1), rgba(255,239,223, 1));
-webkit-background-clip: text;
-webkit-text-fill-color: rgba(82,74,72,0.5);
}
<div>
<h1>LINEAR GRADIENT TEXT</h1>
</div>
With how this works, I don't see another way to do what you are suggesting
Other then create an absolute div with exact same contents directly over this one and specifying the color property. I would go with the first solution
So i'm new to using css and im currently working on a forum thats using xenforo. However I thought it'd be neat to see this effect in place of the admins or moderators usernames.
If you guys could help me out or give me some info on how to go about it that'd be great!
Heres a Video of what I mean if you don't know:
https://www.youtube.com/watch?v=XdL9iDQs3t8
Also, I'm trying to do this all in css only for the "User Name CSS" field on xenforo. I'll keep tryig to figure it out but thanks if you can help!
The closest thing to the text in that video, would be to have a rainbow gradient across the entire phrase, not a different colour per letter.
I have created an example here:
.rainbow_text {
display: inline-block;
background: black;
background: linear-gradient(to right, red, orange , yellow, green, blue, indigo, violet);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.rainbow_text.animated {
animation: rainbow_animation 5s ease-in-out infinite;
background-size: 400%;
}
#keyframes rainbow_animation {
0%, 100% {
background-position: 0
}
50% {
background-position: 100%
}
}
<h1 class='rainbow_text'>Austen Holland</h1>
<br>
<h1 class='rainbow_text animated'>Austen Holland Animated</h1>
There are two pieces of CSS that make this possible. background-clip / -webkit-background-clip: and color.
When the background-clip property is set to text, the background is painted within (clipped to) the foreground text.
When the color property is set to transparent, the text is.. well.. transparent. That allows the gradient from the background to show through!
There a few catches here though, and that's browser support with background-clip: text;!
Internet explorer does not support it at all, and chrome, opera, safari, android all require the -webkit- vendor prefix. Browsers like edge and firefox support it without the prefix.
The background-color of my body is #ffffff. And I have a div that I need is colored but it needs to be transparent or see through. Is it possible to do this using CSS3 or do I have to use images to achieve this?
body {
background-color: #ffffff;
}
.box {
background-color: #999999;
background-image: linear-gradient(to top, #999999 0%, #444444 100%) !important;
opacity: 0.7;
}
Update:
If you go here: http://pinesframework.org/pnotify/#demos-simple and look for the demo for Transparent Success you can see how the pop-up looks see through on a white background. I need to do something like that without using an image as they are using one.
It sounds like you want an alpha transparent background color. If that's the case, you can use RGBA colors, rather than a solid hex value and an opacity property. This way, only the background will have transparency, not the content.
In your case it would be:
.box {
background-color: rgba(255,0,0,0.7);
}
You can also specify a fallback color to browsers that don't support RGBA (IE 8 and older), or create a PNG image with the color fill you want. My vote is toward progressive enhancement, and just specify an alternate color for browsers that don't understand RGBA:
.box {
background-color: #ff4c4c;
background-color: rgba(255,0,0,0.7);
}
UPDATED: Per your comment below, this question appears to be a duplicate of CSS - Opaque text on low opacity div?.
You need to change the opacity of the background instead of the element:
.box {
rgba(255,0,0,0.6);
}
Or, since you are using a gradient, I would use this:
Ultimate CSS Gradient Generator
It will allow you to do semi-transparent backgrounds with a gradient.
I am trying to get a transparent PNG & Gradient to display at the same in IE. Right now, the filter dominates over the background image. If I take out the filter, the PNG does display. Ideally, I would like the PNG to be on top of the gradient.
CSS:
.defaultSelection {
border: 1px solid #bbb; color: #222222; outline: 0 none;
background: url('/img/dropdown-arrow.png') right center no-repeat;
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#e9e9e9', endColorstr='#ffffff' )
}
HTML:
<li class="defaultSelection">Current Selection</li>
Good news: This is possible with IE (despite what others have said). But it does need a little hack called CSS3Pie.
CSS3Pie is a hack for IE which allows it to support a variety of CSS3 features using ordinary CSS, rather than those horrible filter styles.
See here for its supported features: http://css3pie.com/documentation/supported-css3-features/
You'll note that this includes the ability to specify a background with an image and a gradient:
As described on the page linked above, simply specify your CSS with -pie-background in addition to the normal background style, and also with the Pie behavior style to run the Pie script.
#myElement {
background: url(bg-image.png) no-repeat #CCC; /*non-CSS3 browsers will use this*/
background: url(bg-image.png) no-repeat, -moz-linear-gradient(#CCC, #EEE); /*gecko*/
background: url(bg-image.png) no-repeat, -webkit-gradient(linear, 0 0, 0 100%, from(#CCC) to(#EEE)); /*webkit*/
background: url(bg-image.png) no-repeat, linear-gradient(#CCC, #EEE); /*future CSS3 browsers*/
-pie-background: url(bg-image.png) no-repeat, linear-gradient(#CCC, #EEE); /*PIE*/
behavior: url(PIE.htc);
}
Behind the scenes, CSS3Pie creates a VML element, and layers it with the real element to achieve the desired effects (VML is a vector graphics language which is supported by IE6 and up). But you don't need to know any of this, as Pie goes to some lengths to make itself completely transparent to the developer and to the user. It does have some bugs and known issues, but overall it's a very very good tool for pulling older versions of IE up to some sort of parity with more modern browsers.
Have you tried using the gradient on the li and then applying the image on an element within the li?
<li class="defaultSelection">Current Selection<span class='bg'> </span></li>
.defaultSelection {
border: 1px solid #bbb; color: #222222; outline: 0 none;
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#e9e9e9', endColorstr='#ffffff' )
}
.defaultSelection .bg{
display:inline-block;
width: 10px;
height:10px;
background: transparent url('/img/dropdown-arrow.png') right center no-repeat;
}
This is not possible with IE as a filter gradient is essentially another background image (it takes its place.) Try reversing the order to have the filter first and the bg image last in the CSS selector, you'll most likely see the image.
Your best bet is to go with layering, or make on PNG that has both the image and transparency.