Dan06 Posted November 25, 2008 Share Posted November 25, 2008 I have a form that is validated upon submission and if there are any errors a label error is shown. The problem only occurs when there is an error in the nested fieldset. The label errors are supposed to show next to the input field. However, when, and only when, there is an error in the nested fieldset, the subsequent label errors, when shown, are displayed under the input field label rather then next to the input field itself. The above error only occurs in IE. In firefox, regardless of where/when the errors occur - in the nested fieldset or not - the labels are correctly displayed. Below are my css and html code, if some can tell me how to fix the problem so that IE shows the label errors correctly in all situation, it would be appreciated. Thanks. form.registration { margin-bottom: 10px; } form.registration legend { padding: 0 2px; font-weight: bold; color:#FF6600; } form.registration label { display: inline-block; line-height: 1.8; vertical-align: top; } form.registration fieldset ol { margin: 0; padding: 0; } form.registration fieldset li { list-style: none; padding: 5px; margin: 0; } form.registration fieldset fieldset { border: none; margin: 3px 0 0; } form.registration fieldset fieldset legend { margin-left: -10px; padding: 0 0 5px; font-weight: normal; color:#000000; } form.registration fieldset fieldset label { display: block; width: auto; } form.registration em { font-weight: bold; font-style: normal; color: #f00; } form.registration label { width: 160px; /* Width of labels */ } form.registration fieldset fieldset label { margin-left: 150px; } label.error{ background: transparent url(images/cancel.png) no-repeat scroll left; font-weight:normal; color:red; text-align:left; width:140px; padding-left:25px; display:inline; } <fieldset> <legend>Registration</legend> <ol> <li> <label for="firstName">First Name<em>*</em></label><input type="text" name="firstName" id="firstName"/> <label class="error" for="firstName" id="firstNameError"></label> </li> <li> <label for="lastName">Last Name<em>*</em></label><input type="text" name="lastName" id="lastName" /> <label class="error" for="lastName" id="lastNameError"></label> </li> <fieldset> <legend>Domestic or International?<em>*</em></legend> <label class="error" for="memberType" id="memberTypeError">This field is required.</label> <label><input type="radio" name="memberType" id="domestic" value="domestic"/>Domestic</label> <label><input type="radio" name="memberType" id="international" value="international" />International </label> </fieldset> <li> <label for="email">Email<em>*</em></label><input type="text" name="email" id="email" /> <label class="error" for="email" id="emailError"></label> </li> <li> <label for="password">Password<em>*</em></label><input type="password" name="password" id="password" /> <label class="error" for="password" id="passwordError"></label> </li> <li> <label for="confirmPassword">Confirm Password<em>*</em></label><input type="password" name="confirmPassword" id="confirmPassword" /> <label class="error" for="confirmPassword" id="confirmPasswordError"></label> </li> <center><p><input type="submit" name="signUp" value="Sign-Up"/></p></center> </ol> </fieldset> Quote Link to comment Share on other sites More sharing options...
dbrimlow Posted November 27, 2008 Share Posted November 27, 2008 You can't "embed" non list elements within a list - like fieldset or paragraph. Once you start using li tags, you are committed to using them to contain all data until the closing ul or ol tag. There is no tag "center" in valid xhtml or html 4.1. That was old html 3 stuff. Use a class in the css like: css - .center {text-align:center} html - <p class="center"> or an inline style like <p style="text-align:center"> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.