|
웹 개발을 배우면서 로그인 및 등록 양식을 사용하여 웹 사이트를 만드는 것은 초보자부터 중급 웹 개발자에게 가장 적합한 프로젝트가 될 수 있습니다.
오늘 이 블로그에서는 HTML, CSS 및 JavaScript를 사용하여 로그인 및 등록 양식이 포함된 웹사이트를 구축하는 방법을 배우게 됩니다 . 이전에 로그인 및 등록 양식을 사용하여 많은 웹사이트를 디자인했지만 이들은 별도의 개체로 만들어졌습니다.
주어진 웹사이트 이미지에서 볼 수 있듯이 오늘 만드는 방법을 배우게 될 로그인 및 가입 양식이 포함되어 있습니다. 웹사이트에는 로고가 있는 탐색 모음과 양식을 전환하는 버튼이 있는 탐색 링크가 있습니다. 로그인 및 등록 양식을 전환하려면 양식 하단에 버튼이 있습니다.
HTML CSS 및 JS로 된 로그인 및 등록 양식이 있는 웹사이트
<!DOCTYPE html>
<!-- Coding By CodingNepal - codingnepalweb.com -->
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Website with Login & Registration Form</title>
<link rel="stylesheet" href="style.css" />
<!-- Unicons -->
<link rel="stylesheet" href="https://unicons.iconscout.com/release/v4.0.0/css/line.css" />
</head>
<style>
/* Import Google font - Poppins */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Poppins", sans-serif;
}
a {
text-decoration: none;
}
.header {
position: fixed;
height: 80px;
width: 100%;
z-index: 100;
padding: 0 20px;
}
.nav {
max-width: 1100px;
width: 100%;
margin: 0 auto;
}
.nav,
.nav_item {
display: flex;
height: 100%;
align-items: center;
justify-content: space-between;
}
.nav_logo,
.nav_link,
.button {
color: #fff;
}
.nav_logo {
font-size: 25px;
}
.nav_item {
column-gap: 25px;
}
.nav_link:hover {
color: #d9d9d9;
}
.button {
padding: 6px 24px;
border: 2px solid #fff;
background: transparent;
border-radius: 6px;
cursor: pointer;
}
.button:active {
transform: scale(0.98);
}
/* Home */
.home {
position: relative;
height: 100vh;
width: 100%;
background-image: url("bg.jpg");
background-size: cover;
background-position: center;
}
.home::before {
content: "";
position: absolute;
height: 100%;
width: 100%;
background-color: rgba(0, 0, 0, 0.6);
z-index: 100;
opacity: 0;
pointer-events: none;
transition: all 0.5s ease-out;
}
.home.show::before {
opacity: 1;
pointer-events: auto;
}
/* From */
.form_container {
position: fixed;
max-width: 320px;
width: 100%;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(1.2);
z-index: 101;
background: #fff;
padding: 25px;
border-radius: 12px;
box-shadow: rgba(0, 0, 0, 0.1);
opacity: 0;
pointer-events: none;
transition: all 0.4s ease-out;
}
.home.show .form_container {
opacity: 1;
pointer-events: auto;
transform: translate(-50%, -50%) scale(1);
}
.signup_form {
display: none;
}
.form_container.active .signup_form {
display: block;
}
.form_container.active .login_form {
display: none;
}
.form_close {
position: absolute;
top: 10px;
right: 20px;
color: #0b0217;
font-size: 22px;
opacity: 0.7;
cursor: pointer;
}
.form_container h2 {
font-size: 22px;
color: #0b0217;
text-align: center;
}
.input_box {
position: relative;
margin-top: 30px;
width: 100%;
height: 40px;
}
.input_box input {
height: 100%;
width: 100%;
border: none;
outline: none;
padding: 0 30px;
color: #333;
transition: all 0.2s ease;
border-bottom: 1.5px solid #aaaaaa;
}
.input_box input:focus {
border-color: #7d2ae8;
}
.input_box i {
position: absolute;
top: 50%;
transform: translateY(-50%);
font-size: 20px;
color: #707070;
}
.input_box i.email,
.input_box i.password {
left: 0;
}
.input_box input:focus ~ i.email,
.input_box input:focus ~ i.password {
color: #7d2ae8;
}
.input_box i.pw_hide {
right: 0;
font-size: 18px;
cursor: pointer;
}
.option_field {
margin-top: 14px;
display: flex;
align-items: center;
justify-content: space-between;
}
.form_container a {
color: #7d2ae8;
font-size: 12px;
}
.form_container a:hover {
text-decoration: underline;
}
.checkbox {
display: flex;
column-gap: 8px;
white-space: nowrap;
}
.checkbox input {
accent-color: #7d2ae8;
}
.checkbox label {
font-size: 12px;
cursor: pointer;
user-select: none;
color: #0b0217;
}
.form_container .button {
background: #7d2ae8;
margin-top: 30px;
width: 100%;
padding: 10px 0;
border-radius: 10px;
}
.login_signup {
font-size: 12px;
text-align: center;
margin-top: 15px;
}
</style>
</head>
<body>
<!-- Header -->
<header class="header">
<nav class="nav">
<a href="#" class="nav_logo">CodingLab</a>
<ul class="nav_items">
<li class="nav_item">
<a href="#" class="nav_link">Home</a>
<a href="#" class="nav_link">Product</a>
<a href="#" class="nav_link">Services</a>
<a href="#" class="nav_link">Contact</a>
</li>
</ul>
<button class="button" id="form-open">Login</button>
</nav>
</header>
<!-- Home -->
<section class="home">
<div class="form_container">
<i class="uil uil-times form_close"></i>
<!-- Login From -->
<div class="form login_form">
<form action="#">
<h2>Login</h2>
<div class="input_box">
<input type="email" placeholder="Enter your email" required />
<i class="uil uil-envelope-alt email"></i>
</div>
<div class="input_box">
<input type="password" placeholder="Enter your password" required />
<i class="uil uil-lock password"></i>
<i class="uil uil-eye-slash pw_hide"></i>
</div>
<div class="option_field">
<span class="checkbox">
<input type="checkbox" id="check" />
<label for="check">Remember me</label>
</span>
<a href="#" class="forgot_pw">Forgot password?</a>
</div>
<button class="button">Login Now</button>
<div class="login_signup">Don't have an account? <a href="#" id="signup">Signup</a></div>
</form>
</div>
<!-- Signup From -->
<div class="form signup_form">
<form action="#">
<h2>Signup</h2>
<div class="input_box">
<input type="email" placeholder="Enter your email" required />
<i class="uil uil-envelope-alt email"></i>
</div>
<div class="input_box">
<input type="password" placeholder="Create password" required />
<i class="uil uil-lock password"></i>
<i class="uil uil-eye-slash pw_hide"></i>
</div>
<div class="input_box">
<input type="password" placeholder="Confirm password" required />
<i class="uil uil-lock password"></i>
<i class="uil uil-eye-slash pw_hide"></i>
</div>
<button class="button">Signup Now</button>
<div class="login_signup">Already have an account? <a href="#" id="login">Login</a></div>
</form>
</div>
</div>
</section>
<script src="script.js"></script>
</body>
</html>
index_tag
const formOpenBtn = document.querySelector("#form-open"),
home = document.querySelector(".home"),
formContainer = document.querySelector(".form_container"),
formCloseBtn = document.querySelector(".form_close"),
signupBtn = document.querySelector("#signup"),
loginBtn = document.querySelector("#login"),
pwShowHide = document.querySelectorAll(".pw_hide");
formOpenBtn.addEventListener("click", () => home.classList.add("show"));
formCloseBtn.addEventListener("click", () => home.classList.remove("show"));
pwShowHide.forEach((icon) => {
icon.addEventListener("click", () => {
let getPwInput = icon.parentElement.querySelector("input");
if (getPwInput.type === "password") {
getPwInput.type = "text";
icon.classList.replace("uil-eye-slash", "uil-eye");
} else {
getPwInput.type = "password";
icon.classList.replace("uil-eye", "uil-eye-slash");
}
});
});
signupBtn.addEventListener("click", (e) => {
e.preventDefault();
formContainer.classList.add("active");
});
loginBtn.addEventListener("click", (e) => {
e.preventDefault();
formContainer.classList.remove("active");
});
How To Create A Website With Login And Register | HTML & CSS & Javascript
|
첫댓글 https://band.us/band/70730475
https://www.w3schools.com/css/tryit.asp?filename=trycss_default
https://www.google.com/search?client=avast-a-1&q=How+To+Create+A+Website+With+Login+And+Register+%7C+HTML+%26+CSS+%26+Javascript&ie=UTF-8
https://www.google.com/search?q=How+To+Create+A+Website+With+Login+And+Register+%7C+HTML+%26+CSS+%26+Javascript&client=avast-a-1&sca_esv=585196409&tbm=isch&sxsrf=AM9HkKkGlSXGfSd9ytqcCzhaCt8PV8NfrA:1700896015712&source=lnms&sa=X&ved=2ahUKEwjWyMO2y96CAxWOa_UHHdGDBWkQ_AUoAnoECAMQBA&cshid=1700896037968981&biw=1904&bih=942&dpr=1
https://www.codingnepalweb.com/website-login-registration-form-html-css-javascript/
!DOCTYPE html>
<html>
<body>
<h2>My First JavaScript</h2>
<button type="button"
onclick="document.getElementById('demo').innerHTML = Date()">
Click me to display Date and Time.</button>
<p id="demo"></p>
</body>
</html>