Lypheus
06-22-2007, 04:36 PM
Alright, so I'm trying to make a page where I have overlapping divs. Basically, I want a block of text that has sections "highlighted". The problem is that some highlighted sections may overlap one another.
As an example, say I have just two regions to highlight, denoted by @ and *.
The red fox *jumped over the green @moon and* landed on the blue@ cow.
So as you can see above, I would like to see *jumped ... and* as a single highlighted block and @moon ... blue@ as another, the problem is that the start @ tag gets matched to the * end tag so instead I have "moon and" highlighted and the one big div for "jumped ... blue".
Try the following to see what I mean (code at bottom of post).
Ok so things I have tried: Z index (makes no diff as the problem is in matching start/end tags), putting an "id" attribute in the ending tag (does not seem to be supported).
I realize theres a solution here by generating multiple sets of tags to simulate an overlapping behaviour, but its not what I'm looking for (if this is the only approach I'll have to disallow multiple highlights or overlaping highlights at least).
Any ideas?
<style type=text/css>
#test
{
outline-style: dashed;
border-width: 1px;
background: #FFFDAD;
display: inline;
}
#test2
{
outline-style: dashed;
border-width: 1px;
background: #000AAA;
display: inline;
}
</style>
<html>
<body>
The red fox <div id="test">jumped over the green <div id="test2">moon and</div> landed on the blue</div> cow
</body>
</html>
As an example, say I have just two regions to highlight, denoted by @ and *.
The red fox *jumped over the green @moon and* landed on the blue@ cow.
So as you can see above, I would like to see *jumped ... and* as a single highlighted block and @moon ... blue@ as another, the problem is that the start @ tag gets matched to the * end tag so instead I have "moon and" highlighted and the one big div for "jumped ... blue".
Try the following to see what I mean (code at bottom of post).
Ok so things I have tried: Z index (makes no diff as the problem is in matching start/end tags), putting an "id" attribute in the ending tag (does not seem to be supported).
I realize theres a solution here by generating multiple sets of tags to simulate an overlapping behaviour, but its not what I'm looking for (if this is the only approach I'll have to disallow multiple highlights or overlaping highlights at least).
Any ideas?
<style type=text/css>
#test
{
outline-style: dashed;
border-width: 1px;
background: #FFFDAD;
display: inline;
}
#test2
{
outline-style: dashed;
border-width: 1px;
background: #000AAA;
display: inline;
}
</style>
<html>
<body>
The red fox <div id="test">jumped over the green <div id="test2">moon and</div> landed on the blue</div> cow
</body>
</html>