html - css tricks for background image blur -
i want blur background image has made content blur , tried set z-index guess not working here html , need solution explanation please:
<!doctype html> <html> <head> <title>student-login</title> <link href='http://fonts.googleapis.com/css?family=shadows+into+light' rel='stylesheet' type='text/css'> <link rel="stylesheet" type="text/css" href="main.css"> </head> <body> <div class="body"> <div class="main-form"> <h1>student login</h1> <form class="login"> <input type="text" placeholder="*user name" name="user_name"></input><br> <input type="password" placeholder="*password" name="user_name"></input><br> <input type="button" value="login"></input><br> <div class="button"><a href="register.html">register</a></div> </form> </div> </div> </body> </html>
here css file:
.body{ position: absolute; top: -20px; left: -20px; right: -40px; bottom: -40px; width: auto; height: auto; background-image: url("background.jpg"); background-size: cover; -webkit-filter: blur(5px); filter:blur(5px); z-index: 0; } h1{ font-family: 'shadows light', cursive; color: #282828; text-align: center; margin: 2%; } .main-form{ float: right; margin-top: 3%; height:auto; border-radius: 3px; background:#f0f0f0; opacity: .6; padding-top: 1%; padding-left: 4%; padding-right: 4%; padding-bottom: 1%; z-index: 1; } .login input[type="text"]{ width: 260px; height: 35px; border-radius: 2px; border: 1px solid #505050 ; background: transparent; margin: 2%; } .login input[type="text"]:focus{ border: 1px solid #0033ff; } .login input[type="password"]{ width: 260px; height: 35px; border-radius: 2px; border: 1px solid #505050 ; background: transparent; margin: 2%; } .login input[type="password"]:focus{ border: 1px solid #0033ff; } .login input[type="button"]{ width: 265px; height: 35px; border-radius: 2px; border: 1px solid #505050 ; background: transparent; margin: 2%; font-family: 'shadows light', cursive; font-size: 100%; font-weight: bold; } .login input[type="button"]:hover{ background-color: #404040; color: white; } .button { width: 270px; height: 35px; border-radius: 2px; border: 1px solid #505050 ; background: transparent; margin: 2%; font-family: 'shadows light', cursive; font-size: 100%; font-weight: bold; text-decoration: none; color:black; text-align: center; } .button a{ font-family: 'shadows light', cursive; font-size: 100%; font-weight: bold; text-decoration: none; color:black; text-align: center; } .button:hover{ background-color: #404040; } .button:hover a{ color: white; } .login select{ width: 265px; height: 35px; border-radius: 2px; border: 1px solid #505050 ; background: transparent; margin: 2%; font-family: 'shadows light', cursive; font-size: 100%; font-weight: bold; } .login select:hover{ background-color: #404040; color: white; } ::-webkit-input-placeholder { color: red; } :-moz-placeholder { /* firefox 18- */ color: red; } ::-moz-placeholder { /* firefox 19+ */ color: red; } :-ms-input-placeholder { color: red; }
i believe firefox's 3ddomviewer illustrate whats going on here. moreover, trying blur being applied main-form id
b/c child of body div
applying to. now, why z-index not working (****crackes knuckles****). okay, z-index works on elements have position! in main-form div position isn't set once give position , set z-index large negative number disappear being hidden of other elements stacked on top of it. see this article more info. hope helps.
Comments
Post a Comment