DIV vs. SPAN
If we use this code:
This is <div>some</div> text
It looks like this:
This is
If we use this code:
This is <span>some</span> text
It looks like this:
This is some text
I used the bolded text so that you could see what I was talking about. If you used the code specifically, the text wouldn't be bolded.
Cross-browser statically positioned elements
In IE 4+ and NS 6, you can do just about anything you want to statically positioned layers (some exceptions such as filters), but in NS 4, you can't do much to statically positioned <div> and <span> tags. Instead, we'll have to use Netscape 4's proprietary <layer> tag, coupled with it's <ilayer> tag, which allows us to apply DHTML effects to statically positioned elements. For example, let's say we wanted to apply a mouseover background color change in IE 4+ and NN 4+ in a table cell. It's unrealistic to use absolutely positioned layers over the table, so instead, we can use this code:
<table>
<tr>
<td style="background-color:purple"
onmouseover="this.style.backgroundColor='green'" onmouseout="this.style.backgroundColor='purple'"><ilayer><layer
onmouseover="this.bgColor='green'" onmouseout="this.bgColor='purple'">
This is the cell's text
</layer></ilayer></td>
<td style="background-color:purple" onmouseover="this.style.backgroundColor='green'"
onmouseout="this.style.backgroundColor='purple'"><ilayer><layer
onmouseover="this.bgColor='green'" onmouseout="this.bgColor='purple'">
This is the cell's text
</layer></ilayer></td>
<td style="background-color:purple" onmouseover="this.style.backgroundColor='green'"
onmouseout="this.style.backgroundColor='purple'"><ilayer><layer
onmouseover="this.bgColor='green'" onmouseout="this.bgColor='purple'">
This is the cell's text
</layer></ilayer></td>
</tr>
</table>
And that produces:
Which works in all browsers; go ahead and try it!
Now, using that technique (<layer> inside of an <ilayer> for Netscape 4 and a regular <div> tag for IE 4+ and Netscape 6), you can do almost anything you want statically positioned, including changing a layer's content.
Copyright © The Web Design Resource. All rights reserved.
