Login Please fill in your email and password.
3) Creating a Welcome Page Below is the code for the welcome.php file. Users will be redirected to this page after a successful login process. We have added some code at the top of the page to check if the user is not logged in, then redirect the user to the login page.
Let’s create a welcome.php file and paste the following code in it.
?> Welcome
Hello, . Welcome to demo site. Log Out
4) The Logout script Finally, Let’s create a logout.php file with the following code in it.
Once the user clicks on the Log Out link, the above script, will be called to destroy the session and redirect user to the login.php file.
Conclusion In this tutorial, I explained how you can create a Login System using HTML, PHP and MySQL. Once you understand how simple it is to create a login system you can add other features like reset password, forgot password, verify email address, edit user’s profile, etc.
Источник
Learn how to create a responsive login form with CSS.
Click on the button to open the login form:
Step 1) Add HTML: Add an image inside a container and add inputs (with a matching label) for each field. Wrap a element around them to process the input. You can learn more about how to process input in our PHP tutorial.
Example
Step 2) Add CSS: Example /* Bordered form */ form border: 3px solid #f1f1f1; >
/* Full-width inputs */ input[type=text], input[type=password] width: 100%; padding: 12px 20px; margin: 8px 0; display: inline-block; border: 1px solid #ccc; box-sizing: border-box; >
/* Set a style for all buttons */ button background-color: #04AA6D; color: white; padding: 14px 20px; margin: 8px 0; border: none; cursor: pointer; width: 100%; >
/* Add a hover effect for buttons */ button:hover opacity: 0.8; >
/* Extra style for the cancel button (red) */ .cancelbtn width: auto; padding: 10px 18px; background-color: #f44336; >
/* Center the avatar image inside this container */ .imgcontainer text-align: center; margin: 24px 0 12px 0; >
/* Avatar image */ img.avatar width: 40%; border-radius: 50%; >
/* Add padding to containers */ .container padding: 16px; >
/* The «Forgot password» text */ span.psw float: right; padding-top: 16px; >
/* Change styles for span and cancel button on extra small screens */ @media screen and (max-width: 300px) span.psw display: block; float: none; > .cancelbtn width: 100%; > >
Step 1) Add HTML: Example Step 2) Add CSS: Example /* The Modal (background) */ .modal display: none; /* Hidden by default */ position: fixed; /* Stay in place */ z-index: 1; /* Sit on top */ left: 0; top: 0; width: 100%; /* Full width */ height: 100%; /* Full height */ overflow: auto; /* Enable scroll if needed */ background-color: rgb(0,0,0); /* Fallback color */ background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ padding-top: 60px; >
/* Modal Content/Box */ .modal-content background-color: #fefefe; margin: 5px auto; /* 15% from the top and centered */ border: 1px solid #888; width: 80%; /* Could be more or less, depending on screen size */ >
/* The Close Button */ .close /* Position it in the top right corner outside of the modal */ position: absolute; right: 25px; top: 0; color: #000; font-size: 35px; font-weight: bold; >
/* Close button on hover */ .close:hover, .close:focus color: red; cursor: pointer; >
/* Add Zoom Animation */ .animate -webkit-animation: animatezoom 0.6s; animation: animatezoom 0.6s >
Tip: You can also use the following javascript to close the modal by clicking outside of the modal content (and not just by using the «x» or «cancel» button to close it):
Example
// When the user clicks anywhere outside of the modal, close it window.onclick = function(event) if (event.target == modal) modal.style.display = «none»; > >
Tip: Go to our HTML Form Tutorial to learn more about HTML Forms.
Tip: Go to our CSS Form Tutorial to learn more about how to style form elements.
Ever heard about W3Schools Spaces ? Here you can create your website from scratch or use a template, and host it for free.
Источник
Responsive Login Page in HTML with CSS Code Hello Coder! Welcome to the Codewithrandom blog. In this article, we create a Responsive Login Page in HTML with CSS Code. We have 2 input fields in the Login Page of email and password and we have Forgot Password link below the password input field.
So let’s write HTML Code for our Login Form and create a baisc structure for the login form.
Do you want to learn HTML to JavaScript? 🔥
If yes, then here is our Master Frontend: Zero to Hero eBook! 📚 In this eBook, you’ll learn complete HTML, CSS, Bootstrap, and JavaScript from beginner to advance level. 💪 It includes 450 Projects with source code.
Then use some text like forgot password, login text with a button, and use social media icon.
Here you👇 can see an output with only Html🤯 Code.
Html Output:-
Let’s Write Css Code for styling and making a responsive login page.
CSS Code For Responsive Login Page:- * < margin: 0; padding: 0; box-sizing: border-box; >.container < height: 100vh; margin: 0 auto; position: relative; background: linear-gradient(to right, #25aae1, #4481eb, #04befe, #3f86ed); >.container .form-1 < display: flex; flex-direction: column; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #fff; width: 40%; box-shadow: 0 19px 38px rgba(0, 0, 0, 0.3); >.form-1 h1 < text-align: center; margin-top: 0.7rem; margin-bottom: 1.5rem; >input[type="email"], input[type="password"] < border: none; outline: none; border-bottom: 1px solid; background: none; margin: 0.9rem 2rem; font-size: 1rem; >label < margin: 0 2rem; >span < margin: 0 2rem; color: blue; cursor: pointer; >button < margin: 2rem; margin-bottom: 1.5rem; padding: 0.5rem; cursor: pointer; border-radius: 1rem; border: none; font-size: 1.1rem; font-weight: bolder; color: #fff; background: linear-gradient(to right, #25aae1, #4481eb, #04befe, #3f86ed); >/* . ///Sign-Up///. */ p < text-align: center; font-weight: bolder; >.icons < display: flex; justify-content: center; margin-bottom: 3rem; margin-top: 0.5rem; >.icons a < text-decoration: none; font-size: 1rem; margin: 0.2rem; >.icons .fa-facebook-f < border-radius: 50%; background: #5d75ab; color: #fff; padding: 1rem; >.icons .fa-twitter < border-radius: 50%; background: #1da1f2; color: white; padding: 1rem; >.icons .fa-google < border-radius: 50%; background: #ee5645; color: #fff; padding: 1rem; >/* . ///Media query///. */ @media (max-width: 501px) < html < font-size: 15px; >.container .form-1 < width: 300px; >> @media (min-width: 501px) and (max-width: 768px) < html < font-size: 14px; >.container .form-1 < width: 450px; >> @media (min-width: 765px) and (max-width: 1200px) < html < font-size: 18px; >.container .form-1 < width: 540px; height: 550px; >> @media (orientation: landscape) and (max-height: 500px) < .container < height: 100vmax; >> We have utilized some fundamental CSS ideas to style the login page. We’ll adjust the padding and margin to “zero” and the outline to “none” using the universal selector tag. After that, we will style the container by setting its height to “100vh” and its background to “linear-gradient” using the background property. To add styling to the form inside our login page, all we need to do is utilize the class selector.
This is all the Css code for our login Page form with the social media icon. We use Css basic code to style our login Page form. We style the form and then use input type email and password styling together.
Then styling our social media icon using font awesome classes. Then use a media query for a responsive Login Page form. We use 3 to 4 media queries to make a responsive login Page form.
Источник