WebTricks
Home
Home
Tutorials
Q&A Forum
Blog
Videos
Sign up / Register
CSS Forms and Buttons - Playground
Back to Lesson
HTML Code
<!DOCTYPE html> <html> <head> <title>CSS Forms and Buttons</title> <meta charset="UTF-8"> </head> <body> <h1>CSS Forms and Buttons</h1> <div class="form-container"> <h3>Log In Form Example</h3> <div class="form-div"> <input type="text" class="full-width" placeholder="Enter your username"> </div> <div class="form-div"> <input type="password" class="full-width" placeholder="Enter your password"> </div> <div class="form-div"> <label class="checkbox-label"><input type="checkbox" checked><span class="custom-checkbox"></span> Remember me</label> </div> <div class="form-div"> <input type="submit" class="submit-btn" value="Log In"> </div> </div> <style> .form-container{ background: #fff; border: 1px solid #d7d7d7; box-shadow: 0 0 5px #ccc; padding: 15px; width: 50%; margin: auto; } .form-container h3{ font-size: 24px; margin-top: 0; text-align: center; border-bottom: 3px solid #333; padding-bottom: 5px; } .form-div{ margin-bottom: 10px; } .form-div:last-child{ margin-bottom: 0; } .full-width{ width: 100%; padding: 5px 10px; background: #fff; border: 1px solid #ccc; box-sizing: border-box; } .full-width:focus{ border: 1px solid #66afe9; } .checkbox-label{ cursor: pointer; display: block; position: relative; padding-left: 25px; } .checkbox-label input{ display: none; } .custom-checkbox { position: absolute; top: 0; left: 0; height: 20px; width: 20px; border: 1px solid #d7d7d7; } .custom-checkbox:hover{ box-shadow: 0 0 3px #999; } .checkbox-label input:checked ~ .custom-checkbox{ background: #5cb85c; } .custom-checkbox:after { content: ""; position: absolute; display: none; left: 6px; top: 2px; width: 5px; height: 10px; border: solid white; border-width: 0 3px 3px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); } .checkbox-label input:checked ~ .custom-checkbox:after { display: block; } .submit-btn{ padding: 6px 12px; font-size: 14px; color: #fff; background: #5cb85c; border: 1px solid #4cae4c; border-radius: 4px; cursor: pointer; } .submit-btn:hover{ background: #4cae4c; border: 1px solid #5cb85c; } </style> </body> </html>
CSS Code
/* Write your CSS here */
Run Code