I never particularly cared much for them. I had nothing against them. I personally (unlike others) found having all the images in one graphic file easier to maintain; and yes it was less of a server hit but I never had a time, until now, where I found sprites to be indispensable.
I have a complex image: an intertwined pie-chart that highlights as different parts are rolled over. And now - I have a use for sprites. I cannot see how this user interface could have been accomplished without sprites. One can even imagine, that with javascript, one can display different information based on other factors than simply the mouseover.
For example a class name could be added to the div (via server-side script) based on almost any factor and then different information could be shown to different users (or even the same user) as needed.
This user interface is for the marketing department of a well-know company. It displays the course work and tests necessary for employees a variety of certification. So class names can be appended to the div; and javascript can display different text as needed. Example: If user has completed course X then show "Completed" elseif show "In Progress" else "Not Started".
Showing posts with label CSS. Show all posts
Showing posts with label CSS. Show all posts
Sunday, June 11, 2006
Tuesday, August 26, 2003
What's the difference between using a class inside a table cell tag and using a span tag in a table cell?
In other words what is the difference between:
<td class="myClass"></td>
<td><span class="myClass"></span></td>
In the first case you are applying your class to a block level element (<td>) whereas in the latter case the <span> creates an inline element.
The first example will apply to all the content in the td (or the cell itself) whereas the second one applies only to the items wrapped in the span and does not effect the cell itself.
As to whether it matters, it depends on what you're doing with the style. If you are just setting font styles, then either is probably fine. If you're going to do a background color or underlining or padding effects, you need to consider if you want that applied to the text block or to the cell. See the example below.
There are still a few browsers which won't apply styles within a <td>, including NS4.x.
In general, unless you’re designing for these browsers, use the class in the table tag. The span is just an extra piece of code. Try to reserve using span to very discreet items. For instance: a word that receives special treatments.
In other words what is the difference between:
<td class="myClass"></td>
<td><span class="myClass"></span></td>
In the first case you are applying your class to a block level element (<td>) whereas in the latter case the <span> creates an inline element.
The first example will apply to all the content in the td (or the cell itself) whereas the second one applies only to the items wrapped in the span and does not effect the cell itself.
As to whether it matters, it depends on what you're doing with the style. If you are just setting font styles, then either is probably fine. If you're going to do a background color or underlining or padding effects, you need to consider if you want that applied to the text block or to the cell. See the example below.
There are still a few browsers which won't apply styles within a <td>, including NS4.x.
In general, unless you’re designing for these browsers, use the class in the table tag. The span is just an extra piece of code. Try to reserve using span to very discreet items. For instance: a word that receives special treatments.
Labels:
Cross-Browser Compatibility,
CSS
Subscribe to:
Posts (Atom)
