As the title states, is it possible to make a gradient border in css3 and if so how? I know that you can make gradient backgrounds and there are many generators for that, but I am yet to find one that creates the code for a gradient border.
相关问题
- Adding a timeout to a render function in ReactJS
-
Why does the box-shadow property not apply to a
- Add animation to jQuery function Interval
- jQuery hover to slide?
- Issue with star rating css
1.
Well.. this is no fancy css3 but heres one possible solution:
I made this example for something else before and i just changed the background url of
#childWrap
http://jsfiddle.net/qD4zd/1/ ( note that the gradient isnt very flexible as it is done with images. )
Basic idea is that if you have element that you want to frame with a border with a gradient, pattern or just image you should wrap that element inside another which you will use as the border.
2.
A little more flexible gradient: Another thing you might want to try is http://www.css3pie.com and use the gradient background in outer element to create a border like in my example jsfiddle.
OR
http://www.colorzilla.com/gradient-editor/
( http://jsfiddle.net/qD4zd/2/ )
3.
On a third note.. The first method could be made into more flexible one by using actual
<img>
tag so that you force the image to be specific height and width.. could even look decent.Nothing to do much just add following code:
just add above code to the element and border-image-slice property will set the inner offsets of the element.
Here is a possibility to create a gradient shadow border with CSS3:
Practically this will create an inner shadow border with 10px radius at the edges.
may be other work for you but i have very simple tips for you just replace background-image to border-image like
here is an example of a gradient border that would work under Firefox:
Try something like that in your CSS for it to work.
EDIT: I'm not sure if it will work at all on other browsers.
See the answer to this question: CSS3 Gradient Borders.
Basically, it will only work in Firefox at the moment. You could just use pseudo-elements positioned behind the actual element with gradients on them to create a similar effect, though.