To DIV or to SPAN
First let me say I'm not asking the difference between div and span.
Basically I have an image, and on top of this image is a absolute positioned h3 element with a z-index of 2, in between the h3 and image I want to put a solid background color that is transparent, this is also absolute positioned with a z-index of 1. The reason I'm doing it this way vs. setting margin and padding properties of the h3 element is because I have the opacity property on the solid background set, if I do it that way the h3 element logically also turns semi-transparent, I don't want this to happen [also I'm using sIFR, and it calculates the size of the text based on the properties of the element it's replacing, this though is not really relevant]
The $10,000 question is should I use a div or span for the solid background, which would you consider more semantic? [even though what I'm doing is completely not semantic]
Semantically, I'd say it makes most sense if all siblings are on the same 'level' (block or inline). Mixing block-level children with inline-level siblings is odd.
Since an h3 is block-level, its siblings should also be block-level. In other words, a div would be more appropriate (in my opinion).
Use a div. I've never used a span when I absolutely position the element like that, though I hardly ever positioned anything like this anyway.
I'd have to say I'd agree with using the div element [and the point made about mixing and matching siblings], and if it wasn't for the odd way sIFR calculates the size of the element to be replaced and the transparency issue there are obvious better solutions.
This is probably the first time I've actually used absolute positioning this way in a project. I opted to do it this way because for each article a user posts; on the home page the image is displayed and on top of it the title, this combined with sIFR allowed the look of a custom image without having to actually draw it, logically this saves a bit of time and keeps things modular.
Thanks for your time.
I'd love to see this in action.