JSP div 居中,透明遮罩層,圓角按鈕
阿新 • • 發佈:2019-02-08
最近在搭一個公司的專案框架,然後發現一些js的東西都記不太清晰了。所以就隨手記一點吧:
<style type="text/css">
#login_div{
/* 居中 */
position: absolute;
left: 37%; top: 35%;
width: 500px; height: 330px;
/* 透明遮罩層 */
background:rgba(255,255,255,0.6)
}
/* 圓角按鈕 */
input{border-radius : 5px;}
</style>
<body>
<img src="body的背景圖片"/>
<div id="login_div">
<from>
<table>
<tr><td>使用者名稱:</td></tr>
<tr><td><input type="submit"/></td></tr>
</table >
</from>
</div>
<body>
注: 使用了position: absolute;相對定位 body 的背景圖就不會出來所以就單獨弄一個img標籤引進背景圖片。
另:遮罩層還可以使用z-index來設定
css 選擇器:
級聯選擇: A B C 例項:#login form input
集合選擇: A,B,C 例項:#login, .error, li