I want to create a double boarder at the bottom of a title with two lines of different thicknesses and a 1px space in between. Specifically a top line with a thickness of 2px and a bottom line of 1px.
Here is an image example of what I am aiming to achieve aesthetically -
Other website which have used this design aspect - http://www.rollingstone.com/
So far I have tried - "border-bottom: 1px Solid #000;" with no luck. I would appreciate any further suggestions
Many Thanks
Two problems:
double
rather thansolid
.3px
rather than1px
. (one pixel isn't enough to display a double border plus a gap between them)Your final code would look like this:
See also : http://jsfiddle.net/qRUwk/
Standard CSS can't display the two borders at different thicknesses though. For that, you need to have additional markup. There are hacks that can do it with
before:
andafter:
styles, but they get quite complex.Here's the solution usign the background image used in RollingStone.com
Adjust the padding as needed.
Live demo: http://jsfiddle.net/martinschaer/aQq96/
Try creating these key lines with div's and border-bottom, check this out:
http://jsfiddle.net/R2puF/
Then your HTML:
@Spudley - I wasn't aware of 'double' value for borders, that useful but doesn't give the thicker upper line.
Martin's answer is better than my initial answer (now edited) as it doesn't use an extra div, but you can use his technique without having to use an image like so (this is amended code from Martin's fiddle):
jsfiddle here
By the way, the rollingstone site uses mainly images of double-lined borders, not actual css. I'm sure you are aware, but you can right-click and choose Inspect element from your web-browser to explore how a site has been built. Best way to learn!
Try this CSS
HTML
DEMO.
Here are a couple of other possibilities:
Approach #01:
We can use
linear-gradient()
to fill background of the heading with a combination oftransparent
and solid color like black so that it looks like an outline.Necessary CSS:
Working Example:
Approach #02:
border-bottom
property.linear-gradient()
function that looks like a border.background-size
CSS property control its size.background-position
property.Necessary CSS:
Working Example:
Screenshot:
Useful Resources: