Web Design Forum: Gradient borders - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Gradient borders

#1 User is offline   Konnor 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 39
  • Joined: 18-April 10
  • Reputation: 5

Posted 22 January 2012 - 10:38 PM

Howdy,

I was curious to know how one might code a gradient border in HTML/CSS.

So I have the following in photoshop....

Posted Image

Which is on both sides of the page.

I had thought that I could create an image with both borders in, measuring the entire width, with everything between the borders being transparent. Then saving as a .png. But then I seem to get problems with padding and it doesn't seem like a clean solution.

Does anyone have any thoughts on how I might achieve the above effect?

Thanks,
0

#2 User is online   sash_oo7 

  • Forum Newcomer
  • PipPipPipPip
  • Group: Members
  • Posts: 838
  • Joined: 15-August 10
  • Reputation: 45
  • Gender:Male
  • Location:Mars
  • Experience:Nothing
  • Area of Expertise:Nothing

Posted 23 January 2012 - 07:34 AM

show the full image
0

#3 User is offline   Konnor 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 39
  • Joined: 18-April 10
  • Reputation: 5

Posted 23 January 2012 - 06:48 PM

View Postsash_oo7, on 23 January 2012 - 07:34 AM, said:

show the full image


Link to the full image

http://img210.images...7/fullimage.jpg
0

#4 User is offline   Wickham 

  • Web Guru
  • View gallery
  • Group: Moderators
  • Posts: 2,876
  • Joined: 11-June 09
  • Reputation: 257
  • Gender:Male
  • Location:Salisbury UK
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 23 January 2012 - 07:26 PM

You could use this gradient maker
http://tools.dynamic...e.com/gradient/
to create a vertical gradient about 5px wide and use repeat-x for a background-image to the body style to repeat across the window width or use HTML5/CSS3 gradient.

I can't see why you would need a transparent middle section if the content div has backgrounds for the whole area to show on top of the body background.

This post has been edited by Wickham: 23 January 2012 - 07:28 PM

0

#5 User is offline   porkchops 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,073
  • Joined: 13-March 11
  • Reputation: 228
  • Gender:Male
  • Location:Belmont, Massachusetts
  • Experience:Advanced
  • Area of Expertise:Web Designer

Posted 23 January 2012 - 07:33 PM

Set the background of your container to be the appropriate CSS gradient. Then add a padding of 2px (assuming that's how thick the border is... I'm just eyeballing it). Then nest a black element inside of that. It's not very semantic but it's probably the best technical approach.

This post has been edited by porkchops: 23 January 2012 - 07:34 PM

0

#6 User is online   sash_oo7 

  • Forum Newcomer
  • PipPipPipPip
  • Group: Members
  • Posts: 838
  • Joined: 15-August 10
  • Reputation: 45
  • Gender:Male
  • Location:Mars
  • Experience:Nothing
  • Area of Expertise:Nothing

Posted 23 January 2012 - 09:29 PM

i wud slice the image like the following

Posted Image
the top red part will be thin strip along with the border and the shadow with (no-repeat)

the middle blue part will repeat the shadow (repeat-y)


and the bottom footer part will be single image with no-repeat()

and u can have seperate gradient using css3 or image for background

hope that makes sense?

This post has been edited by sash_oo7: 23 January 2012 - 09:33 PM

0

#7 User is offline   Konnor 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 39
  • Joined: 18-April 10
  • Reputation: 5

Posted 24 January 2012 - 09:23 PM

Thanks for the solutions offered up so far.

I decided to fill the containing div with a 5 pixel repeating image, add a 1px padding on each side, then create all the content inside with a black background.

Think that's mostly what Wickham and porkchops suggested, although I didn't see whether you could create 3 colour gradients in CSS?

Ta,
0

#8 User is offline   porkchops 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,073
  • Joined: 13-March 11
  • Reputation: 228
  • Gender:Male
  • Location:Belmont, Massachusetts
  • Experience:Advanced
  • Area of Expertise:Web Designer

Posted 24 January 2012 - 09:58 PM

View PostKonnor, on 24 January 2012 - 09:23 PM, said:

...although I didn't see whether you could create 3 colour gradients in CSS?


You can add a ton of color stops in CSS, so you can make really complex stuff.

http://www.colorzill...radient-editor/

That's a photoshop-esque way to generate them, and there are many other options out there too.

More complicated:

http://layerstyles.org/builder.html
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users