>  기사  >  웹 프론트엔드  >  HTML로 된 등록 양식

HTML로 된 등록 양식

PHPz
PHPz원래의
2024-09-04 16:44:53408검색

HTML 양식은 오늘날 수많은 웹사이트에서 볼 수 있는 필수 구성 요소로, 사용자 인증, 등록, 피드백 수집 등과 같은 다양한 목적을 수행합니다. 이러한 양식을 사용하면 사이트 방문자로부터 귀중한 데이터와 정보를 쉽게 수집할 수 있습니다.

HTML 양식은 '컨트롤'이라는 특수 요소를 사용하여 구성됩니다. 이러한 컨트롤에는 텍스트 영역, 라디오 버튼, 체크박스, 제출 버튼과 같은 다양한 옵션이 포함되어 있어 사용자가 세부 정보를 효과적으로 입력할 수 있습니다. 사용자는 이러한 컨트롤과 상호 작용하여 텍스트를 입력하고, 특정 항목을 선택하고, 기타 관련 작업을 수행하여 제공된 정보를 수정할 수 있습니다. 양식이 완성되면 제출할 수 있으며, 데이터 추가, 전송, 다른 페이지로 리디렉션, 데이터베이스에 세부 정보 저장 등 다양한 결과가 나타날 수 있습니다.

HTML 양식은 웹사이트 방문자의 참여를 유도하기 위한 대화형의 사용자 친화적인 수단입니다. 이는 사용자와 웹사이트 소유자 간의 원활한 커뮤니케이션과 데이터 교환을 촉진하여 기업이 중요한 통찰력을 수집하고 사용자 경험을 향상시킬 수 있도록 지원합니다.

HTML 양식을 만드는 방법은 무엇입니까?

HTML 양식을 만들려면

양식 콘텐츠의 컨테이너 역할을 하는 요소입니다.
, 과 같은 다른 HTML 요소와 함께 완전한 기능을 갖춘 양식을 디자인할 수 있습니다. 또한 CSS를 활용하여 모양과 사용자 경험을 향상시킬 수 있습니다.

참고: 웹 개발이 처음이고 기본 HTML 코드 작성 방법을 배우려는 경우 HTML로 웹페이지 디자인에 대한 도움말을 참조하세요. HTML 코드 작성에 대한 단계별 가이드를 제공합니다.

이 기사에서 HTML로 웹페이지를 디자인할 때 다루는 주요 사항은 다음과 같습니다.

  1. 프로젝트를 어떻게 설정하나요?
  2. HTML 구조는 어떻게 시작하나요?
  3. 본문에 콘텐츠를 추가하는 방법은 무엇인가요?
  4. 콘텐츠를 어떻게 구성하나요?
  5. HTML 파일을 어떻게 저장하나요?
  6. 웹페이지를 보는 방법은 무엇인가요?

다음은 HTML 양식의 기본 구문입니다.

구문:

<form action = "URL" method = "GET or POST">
form elements like submit or reset buttons, input, text area etc.
</form>

HTML로 된 등록 양식의 예

HTML을 사용한 등록 양식의 몇 가지 예를 살펴보겠습니다.

예시 1: 간단한 등록 양식

간단한 HTML 등록 양식을 만드는 예는 다음과 같습니다.

코드:

<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
}
.container {
width: 400px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border: 1px solid #ccc;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
color: #333;
margin-top: 0;
}
p {
text-align: center;
color: #777;
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 10px;
color: #333;
}
input[type="text"],
input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 4px;
}
hr {
margin-top: 20px;
margin-bottom: 20px;
border: 0;
border-top: 1px solid #ccc;
}
a {
color: #337ab7;
text-decoration: none;
}
button[type="submit"] {
display: block;
width: 100%;
padding: 10px;
margin-top: 20px;
background-color: #4CAF50;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
font-weight: bold;
}
button[type="submit"]:hover {
background-color: #45a049;
}
.container.signin {
text-align: center;
color: #777;
}
</style>
</head>
<body>
<form>
<div class="container">
<h1>Register Here</h1>
<p>Please fill in the details to create an account with us.</p>
<hr>
<label for="email"><b>Enter Email</b></label>
<input type="text" placeholder="Enter Email" name="email">
<label for="pwd"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="pwd">
<label for="confirm"><b>Confirm Password</b></label>
<input type="password" placeholder="Confirm Password" name="confirm">
<hr>
<p>By creating an account you agree to our <a href="#">Terms & Privacy</a>.</p>
<button type="submit" class="registerbtn"><strong>Register</strong></button>
</div>
<div class="container signin">
<p>Already have an account? <a href="#">Sign in</a>.</p>
</div>
</form>
</body>
</html>

출력:

HTML로 된 등록 양식

등록 양식: 검증

사용자가 이메일 주소를 입력할 수 있도록 비밀번호 및 확인 입력 여부와 관계없이 이메일 필드를 작성하지 않고 양식을 제출하려고 하면 팝업을 실행하는 확인 코드가 포함됩니다.

요소와 함께 '필수'라는 키워드는 해당 요소를 채워야 함을 나타냅니다. 이 키워드를 텍스트 필드 '이메일'에 추가하면 아래 결과가 표시됩니다.

<input type="text" placeholder="Enter Email" name="email" required>

비밀번호 및 비밀번호 확인 필드에도 마찬가지로 작업이 필요합니다.

<input type="password" placeholder="Enter Password" name="pwd" required>
<input type="password" placeholder="Confirm Password" name="confirm" required>

출력:
HTML로 된 등록 양식

예시 2: 입사 지원서 양식

다음은 HTML로 입사 지원서 등록 양식을 생성하는 예입니다.

코드:

<!DOCTYPE html>
<html>
<head>
<title>Job Application Registration Form</title>
<style>
body {
font-family: Calibri, sans-serif;
background-color: #72b7f4;
}
h2 {
color: #232729;
text-align: center; /* Center align the title */
}
form {
background-color: #bfddf7;
max-width: 500px;
margin: 0 auto;
padding: 30px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
label {
display: block;
margin-bottom: 10px;
color: #333333;
}
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="file"] {
width: 100%;
padding: 10px;
border: 1px solid #cccccc;
border-radius: 4px;
box-sizing: border-box;
margin-bottom: 15px;
background-color: #ffffff; /* Set background color to white */
}
select {
width: 100%;
padding: 10px;
border: 1px solid #cccccc;
border-radius: 4px;
box-sizing: border-box;
margin-bottom: 15px;
}
input[type="submit"] {
background-color: #1a73e8;
color: #ffffff;
border: none;
padding: 12px 24px;
border-radius: 4px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #0059b3;
}
</style>
</head>
<body>
<h2>Job Application Registration</h2>
<form action="/apply" method="POST">
<label for="name">Full Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email Address:</label>
<input type="email" id="email" name="email" required>
<label for="phone">Phone Number:</label>
<input type="tel" id="phone" name="phone" required>
<label for="resume">Resume (PDF or Word):</label>
<input type="file" id="resume" name="resume" accept=".pdf,.doc,.docx" required>
<label for="position">Position Applied:</label>
<select id="position" name="position" required>
<option value="">Select Position</option>
<option value="frontend-developer">Frontend Developer</option>
<option value="backend-developer">Backend Developer</option>
<option value="graphic-designer">Graphic Designer</option>
</select>
<input type="submit" value="Submit Application">
</form>
</body>
</html>

출력:
HTML로 된 등록 양식

예 3: 호텔 등록 양식

다음은 HTML로 호텔 등록 양식을 생성하는 예입니다.

코드:

<!DOCTYPE html>
<html>
<head>
<title>Hotel Registration Form</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0bd9d;
padding: 20px;
}
form {
max-width: 500px;
margin: 0 auto;
background: linear-gradient(to bottom right, #fff, #f1f1f1);
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
label {
display: block;
margin-bottom: 10px;
font-weight: bold;
}
.form-row {
margin-bottom: 20px;
}
.form-row label {
display: block;
margin-bottom: 5px;
}
.form-row input,
.form-row select {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
font-size: 14px;
}
input[type="submit"] {
padding: 10px 20px;
background: linear-gradient(to bottom right, #db4340, #ff6f00);
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 16px;
}
</style>
</head>
<body>
<img src="image.jpg" alt="Hotel Image" style="display: block; margin: 0 auto 20px; width: 500px;">
<form>
<div class="form-row">
<label for="name">Name</label>
<input type="text" id="name" name="name">
</div>
<div class="form-row">
<label for="email">Email ID</label>
<input type="email" id="email" name="email">
</div>
<div class="form-row">
<label for="phone">Phone Number</label>
<input type="tel" id="phone" name="phone">
</div>
<div class="form-row">
<label for="guests">Number of Guests</label>
<input type="number" id="guests" name="guests">
</div>
<div class="form-row">
<label for="check-in">Check-in Date</label>
<input type="date" id="check-in" name="check-in">
</div>
<div class="form-row">
<label for="check-out">Check-out Date</label>
<input type="date" id="check-out" name="check-out">
</div>
<div class="form-row">
<label for="room-type">Room Type</label>
<select id="room-type" name="room-type">
<option value="">Select Room Type</option>
<option value="single">Single</option>
<option value="double">Double</option>
<option value="suite">Suite</option>
</select>
</div>
<input type="submit" value="Submit">
</form>
</body>
</html>

출력:

HTML로 된 등록 양식

위 내용은 HTML로 된 등록 양식의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
이전 기사:HTML 양식 작업다음 기사:HTML 양식 작업