I was thinking there must be a way to write dates using css for example if i want to display “12th” in html I would use the superscript <sup> tag to make the th appear halfway on top of 12. I dont want to use the <sup> tag cause i want to keep all the styling seperate in the CSS file. Or maybe I’m wrong the best way could be using <sup> tag.
So people shed some light and knowledge on this small problem.
Hi, I’m not quite sure what you mean, of course you can write dates in CSS (well you can style them in CSS, and write it in HTML). What styling issues are you having? A code segment showing this (HTML and CSS) showing the issue and what you would like to achieve will be appreciated.
Unfortunately there isn’t really a better way, all involve an extra element wrapping around those letters, and the method Kevin gave is perfectly fine, however you might wnat to try text resizing to see if it doesn’t break.
That is actually how I would do it. The <sup> tag should be used when the superscript is semantically significant (e.g. in the case of a footnote marker).
The best and recommended (and shorter) way is to use <sup>. You are then marking up the span of characters as being, semantically, a superscript. It will render correctly in all browsers (even Lynx will show it as something like 11^th November 2008).
Kevin’s suggestion of using relative positioning works, too, but the vertical-align property is intended precisely for this sort of thing. I’ve tested it in IE5.5 and up, plus all the modern browsers and it renders correctly.