Is it possible to get the legend text in a <fieldset> to be in the center rather than on the left? Thanks
Is it possible to get the legend text in a <fieldset> to be in the center rather than on the left? Thanks
Unfortunately the<legend>tag can be quite difficult to control. This might be because<fieldset>and<legend>are non-presentational tags (although they might appear presentational).
After a lot of firebugging, the only solution I could find is not only deprecated, but also invalid (yaiks)! What I would recommend is to leave it the way it is, but I'll show you my highly unsemantic solution anyways:
I'm sure that wouldn't even validate in the 90's but it's the only one that does the job. The choice is yours.HTML Code:<legend align="center">Tables for layout, yaay!</legend>
Good luck!
Who cares? It does the job so he should use it. Validation isn't everything. It's one thing if using align="center" on the <legend> tag would break something. But it won't. Validation shouldn't be the ultimate goal - usability and accessibility should. If centering the legend makes the page more user-friendly, then go for it.
In fact, if you're using the legend tag for it's original intent, it's the more semantic approach. I think you're confusing semantics and validation in your statement above.
I agree, but try telling that to some of my clients..
I didn't say it's unsemantic because it doesn't validate, I was just thinking there might be problems with screen readers (which I don't know anything about). Then again, I do tend to refer to semantics when I talk about the overall professionalism of a site so you're right.
Bookmarks