Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hide border if div is above

Tags:

html

css

border

I have a <div id="content"> with a border. Above this div is another <div id="header"> with some text. I would like to show text over border, but i don't want to display it.

For easier explanation i've posted my source code here: http://jsfiddle.net/4HSEn/ and this is what i would like to achieve:

enter image description here

Text will be dynamic and background will be gradient. So image is not a solution.

I know how to achieve this with fieldset and legend tags, but i'm looking for a solution with div or any other tag.

found something here: Is it possible to achieve a <fieldset>-like effect without using the <fieldset> tag? but for the legend was used background-color:#FFF, which does not help me very much :/

like image 707
JercSi Avatar asked Mar 20 '12 18:03

JercSi


1 Answers

Untested theory, but perhaps you could give #header the same gradient background as body's background, then offset #header's background-position (using js) with the X and Y position relative to body?

Basically I'm suggesting a kind of masking effect.

EDIT: replaced #content with body, to be more in line with the OP's current code sample.

like image 55
Jace Avatar answered Nov 24 '22 05:11

Jace