Html 输入值与标签值不一致

Html 输入值与标签值不一致,html,css,forms,Html,Css,Forms,下面是HTML和相关的CSS。有人能指出我做错了什么吗?输入文本框显示在其相应标签的下方 form label.blockLabel { display: block; position: relative; width: 450px; margin: 12px 0px 12px 0px; } form fieldset#contactFields input { position: absolute; margin-left: 140px; }

下面是HTML和相关的CSS。有人能指出我做错了什么吗?输入文本框显示在其相应标签的下方

form label.blockLabel {
    display: block;
    position: relative;
    width: 450px;
    margin: 12px 0px 12px 0px;
}

form fieldset#contactFields input {
    position: absolute;
    margin-left: 140px;
}

这是一把小提琴。我想你只需要把这个

form fieldset
选择器


在这段代码中,一切正常。可能你在某些东西上有显示块。这是可行的,但我会选择左边的标签和右边与标签一致的相应输入。我编辑了你的问题,使其具有正确的缩进。提问时,请确保代码缩进正确,以便于其他人阅读。如果您希望代码与左侧对齐,只需删除边距:
form fieldset
 <fieldset id="contactFields">
                <legend>Contact Information</legend>                        
                    <label class="blockLabel" for="fName">First Name<span>*</span> : 
                        <input type="text" id="fName" name="fName" required="required" />  </label>                         
                    <label class="blockLabel" for="lName">Last Name<span>*</span> : 
                        <input type="text" id="lName" name="lName" required="required" /></label> 
                    <label class="blockLabel" for="email">Email Address<span>*</span>  :
                        <input type="email" id="email" name="email" required="required" /></label> 
                    <label class="blockLabel" for="street">Street Address   : 
                        <input type="text" id="street" name="street" /></label> 
                    <label class="blockLabel" for="city">City : 
                        <input type="text" id="city" name="city" value="Denver" /></label>   
                    <label class="blockLabel" for="state">State    : 
                        <input type="text" id="state" name="state" value="CO" maxlength="2" /></label>  
                    <label class="blockLabel" for="zip">Zip : 
                        <input type="text" id="zip" name="zip" maxlength="10" /></label> 
                    <label class="blockLabel" for="phone">Phone :
                        <input type="tel" id="phone" name="phone" /> </label>                             
            </fieldset> 











<style>
  .blockLabel {
        display: block;
    margin-left: 140px;
    }

    form fieldset #contactFields input {
        position: absolute;
        margin-left: 140px;
    }
</style>