Jump to content

gradient border on bottom of a div (HTML/CSS)

Flanelman
Go to solution Solved by leonfagan71,
9 hours ago, Flanelman said:

Hey guys so I've given this a google and there's a few examples, some I found didn't work and some were top->bottom but I didn't understand the code enough to change the direction because there was no explicit left/right/top/bottom etc.

So pretty much I want to add a border to my header div that starts out light on the left and right, and gets dark at the middle, I would be very grateful if someone could help me out with this! Thanks in advance. :)

Here's some CSS from StackOverflow which seems to do what you want to do but it's inverted.
 

/* gradient shining border */
    border-style: solid;
    border-width: 3px;
    -webkit-border-image: -webkit-linear-gradient(
        left,
        rgba(0,0,0,1) 1%,
        rgba(0,255,255,1) 50%,
        rgba(0,0,0,1) 100%
    ) 0 0 100% 0/0 0 3px 0 stretch;
    -moz-border-image: -moz-linear-gradient(
        left,
        rgba(0,0,0,1) 1%,
        rgba(0,255,255,1) 50%,
        rgba(0,0,0,1) 100%
    ) 0 0 100% 0/0 0 3px 0 stretch;
    -o-border-image: -o-linear-gradient(
        left,
        rgba(0,0,0,1) 1%,
        rgba(0,255,255,1) 50%,
        rgba(0,0,0,1) 100%
    ) 0 0 100% 0/0 0 3px 0 stretch;
    border-image: linear-gradient(
        to left,
        rgba(0,0,0,1) 1%,
        rgba(0,255,255,1) 50%,
        rgba(0,0,0,1) 100%
    ) 0 0 100% 0/0 0 3px 0 stretch;

Just change the rgba values.

 

Regards,
Leon.

Hey guys so I've given this a google and there's a few examples, some I found didn't work and some were top->bottom but I didn't understand the code enough to change the direction because there was no explicit left/right/top/bottom etc.

So pretty much I want to add a border to my header div that starts out light on the left and right, and gets dark at the middle, I would be very grateful if someone could help me out with this! Thanks in advance. :)

Link to comment
Share on other sites

Link to post
Share on other sites

9 hours ago, Flanelman said:

Hey guys so I've given this a google and there's a few examples, some I found didn't work and some were top->bottom but I didn't understand the code enough to change the direction because there was no explicit left/right/top/bottom etc.

So pretty much I want to add a border to my header div that starts out light on the left and right, and gets dark at the middle, I would be very grateful if someone could help me out with this! Thanks in advance. :)

Here's some CSS from StackOverflow which seems to do what you want to do but it's inverted.
 

/* gradient shining border */
    border-style: solid;
    border-width: 3px;
    -webkit-border-image: -webkit-linear-gradient(
        left,
        rgba(0,0,0,1) 1%,
        rgba(0,255,255,1) 50%,
        rgba(0,0,0,1) 100%
    ) 0 0 100% 0/0 0 3px 0 stretch;
    -moz-border-image: -moz-linear-gradient(
        left,
        rgba(0,0,0,1) 1%,
        rgba(0,255,255,1) 50%,
        rgba(0,0,0,1) 100%
    ) 0 0 100% 0/0 0 3px 0 stretch;
    -o-border-image: -o-linear-gradient(
        left,
        rgba(0,0,0,1) 1%,
        rgba(0,255,255,1) 50%,
        rgba(0,0,0,1) 100%
    ) 0 0 100% 0/0 0 3px 0 stretch;
    border-image: linear-gradient(
        to left,
        rgba(0,0,0,1) 1%,
        rgba(0,255,255,1) 50%,
        rgba(0,0,0,1) 100%
    ) 0 0 100% 0/0 0 3px 0 stretch;

Just change the rgba values.

 

Regards,
Leon.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×