1
以下是我的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;}
在這裏,如果我使用的高度:自動;那麼它不會顯示.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;"> Create an Account</label></h3>
<div class="row_2">
<center><?php echo $this->msg; ?></center>
<label class="label2"> </label>
<?php if ($this->displayimage) { ?>
<img src="<?php echo $this->displayimage; ?>"></img>
<?php } ?>
</div>
<div class="row_2">
<label class="label2"> </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"> </label>
<input type="submit" class="submit" value="Submit" name="submit" id="submit">
</div>
</div>
任何幫助,將不勝感激。
@ Er.Aurag Jain:很好.....它解決了...謝謝。但是,請你解釋一下'overflow-y:auto'是什麼,爲什麼沒有它就無法正常工作。 – Sky