Well, what I am trying to do is to align the legend to the middle of the fieldset. It works in IE and Opera but not in FF. Any ideas? legend { width: 100%; text-align: center; } Code (markup):
Ok there's also problem in IE6 - the legend is 7px to the right... but this I have solved with: position: relative; left: 0 !important; left: -7px; Code (markup):
Can't really see where the problem is without a working demonstration but for the FF problem, I guess you could add... legend { margin: auto; } Code (markup): ?
Nope I've tried that already. Didn't work. Well, for working demonstration, just try to center the legend tag in any random form, for example: <form method="post" action=""> <fieldset> <legend>I want this to be centered</legend> // some random input tags here </fieldset> </form> Code (markup):
Oh, I see what the problem is now. I misread/misunderstood the legend tag for the label tag. I don't use the legend tag much nor the fieldset tag much so I don't know much about modifying it with CSS. However, I did search around and it looks like a solution is if you add an attribute to the legend tag. <legend align="center">Center, goddamnit.</legend> Code (markup): However, it looks like this won't validate, but if you don't care much for validation: apparently others are very happy with this alternative.