自动高度未显示标签的边框

时间:2012-12-05 07:04:48

标签: html css

以下是我的CSS代码:

.registerFormContainer{width: 45%;border: 1px solid #2C5887; border-radius: 5px; text-align: center; margin: 0 auto; height: auto;}
    .registerFormContainer h3{padding: 10px; background: #2C5887; border-top-radius: 5px; width: auto;}
    .registerFormContainer h3 label{color: #fff; font-size: 18px; font-weight: bold;}

如果我使用的是高度:auto;然后它不显示.registerFormContainer.registerFormContainer h3的边框。如果我使用像300px这样的手动高度,那么它会显示边框。但是如果我使用手动高度,那么div在验证错误后不会被释放。应该是什么问题?我正在学习CSS,对此并不太了解。

以下是我的HTML

<div class="registerFormContainer">      
    <h3><label style="background-image:url( '/images/lock.png'); width: auto; background-repeat:no-repeat; background-position:left center;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create an Account</label></h3>
    <div class="row_2"> 
        <center><?php echo $this->msg; ?></center>                                                                      
        <label  class="label2">&nbsp;</label>
        <?php if ($this->displayimage) { ?>           
            <img src="<?php echo $this->displayimage; ?>"></img>
        <?php } ?>
    </div>
    <div class="row_2"> 
        <label  class="label2">&nbsp;</label>
        <b>Welcome,  <?php if (isset($this->displayname)) echo $this->displayname; ?></b>                                                                                                
    </div>                                                
    <div class="row_2"> 
        <label  class="label_2" for="username">Email:</label>
        <?php if (isset($this->fbid)) { ?>
            <input class="required" id="username" name="username" type="hidden" value="<?php echo $this->email; ?>"/>
            <?php echo $this->email; ?>
        <?php } else { ?>
            <input class="required" id="username" name="username" type="text"/>        
        <?php } ?>
    </div>
    <div class="row_2">
        <label for="password" class="label_2">Password:</label>
        <input class="required" id="rpassword" name="password" type="password"/>
    </div>
    <div class="row_2" >
        <label for="cpassword" class="label_2">Confirm Password:</label>
        <input class="required" id="cpassword" name="cpassword" type="password"/>
    </div>
    <div class="row_2">                        
        <label class="label_2">&nbsp;</label>
        <input type="submit" class="submit" value="Submit" name="submit" id="submit">
    </div>                                                         
</div>

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:1)

请尝试overflow-y:auto上课registerFormContainer我希望它能为您效劳。

感谢

相关问题