<span><input type="checkbox" class="checkbox" name="autologin" id="autologin"><label for="autologin">下次自動登錄</label></span> <a class="forget" href="#">忘記密碼?</a>
<br>
<input type="button" class="enter" >
<hr>
<input type="button" class="regedit" >
</form>
</div>
<br>
<input type="button" class="enter" >
<hr>
<input type="button" class="regedit" >
</form>
</div>
.forget{text-decoration:none;font-size:13px;float:right; margin:3px 000;}
.enter{display:block;width:180px;height:40px;background-position:0 0;margin:10px 0;}
.regedit{display:block;width:180px;height:40px;background-position:0 -38px;margin:10px 0;}
hr{border:1px solid #dedede;}</style>
.enter{display:block;width:180px;height:40px;background-position:0 0;margin:10px 0;}
.regedit{display:block;width:180px;height:40px;background-position:0 -38px;margin:10px 0;}
hr{border:1px solid #dedede;}</style>
<style>
form{width:180px;background:#EBF3FA;padding:10px;}
input{background:url(http://img1.sycdn.imooc.com//539a972b00013e9102280177.jpg) }
input.user,.key{background:#ffffff;border:1px solid #dedede;padding:5px 0; margin-bottom:10px; text-indent:2em;width:180px;}
label{font-size:13px;}
form{width:180px;background:#EBF3FA;padding:10px;}
input{background:url(http://img1.sycdn.imooc.com//539a972b00013e9102280177.jpg) }
input.user,.key{background:#ffffff;border:1px solid #dedede;padding:5px 0; margin-bottom:10px; text-indent:2em;width:180px;}
label{font-size:13px;}
最贊回答 / 慕數據0204790
首先,不應該使用<table>標簽,因為<table>標簽現在已經過時了(就好像現在你稱呼別人為‘同志’的情況是一樣的),然后div應該不設置高度,讓里面的元素自動撐開就行了,其次代碼還可以簡化,比如你的登錄和注冊按鈕都引用同一張背景圖片,可以簡寫在一行代碼中。最后,‘忘記密碼?’不應該加空格把它稱到右邊,應該使它浮動到右邊(float:right)
2015-11-04