I was styling up a form today, and came across some odd (yet well known) behaviour in IE6 and IE7.
The [tt]legend[/tt] element appears to have a left margin - that you cannot get rid of by setting the margin to zero (as works in all other browsers).
Here is the code as a stand-alone test page:
There are posts that suggest using negative left margins are the solution... but I wasn't able to make them work (with the doctype I have used in this test harness).
If anyone has any suggestions for IE6 and IE7 solutons to this problem... that'd be great!
Cheers,
Jeff
[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]
Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!
FAQ216-6094
The [tt]legend[/tt] element appears to have a left margin - that you cannot get rid of by setting the margin to zero (as works in all other browsers).
Here is the code as a stand-alone test page:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] xml:lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta http-equiv="content-language" content="en"/>
<title>Test Harness</title>
<style type="text/css">
form, fieldset, legend {
margin: 0;
padding: 0;
border: 0;
}
</style>
<body>
<form>
<fieldset>
<legend>Fill in the fields to get access</legend>
<div class="formRow">
<label for="username">Username</label>
<input id="username" type="text"/>
</div>
<div class="formRow">
<label for="password">Password</label>
<input id="password" type="password"/>
</div>
<div class="formRow">
<button id="submit">Submit</button>
</div>
</fieldset>
</form>
</body>
</html>
If anyone has any suggestions for IE6 and IE7 solutons to this problem... that'd be great!
Cheers,
Jeff
[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]
Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!
FAQ216-6094