admin 發表於 2022-8-16 16:46:41

HTML5 : Forms

<!DOCTYPE html>
<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>Bootcamp Registration</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap" rel="stylesheet">
</head>
<body>
<div class="form">
    <h1>Bootcamp Registration Form</h1>
<p>Complete this form to express your interest in the upcoming web development bootcamp.</p>
<form>
<!-- Contact Details -->
    <fieldset class="first-section">
      <legend>Contact Details</legend>
      <label for="name">Name</label>
      <input autofocus type="text" id="name" name="name" autofocus placeholder="Ophy Boamah" autocomplete="on" required> <br><br>
      <label for="email">Email</label>
      <input type="email" id="email" placeholder="[email protected]"> <br><br>
      <label for="tel">Phone</label>
      <input type="tel" id="tel" placeholder="+233 200001212"> <br><br>
    </fieldset>
    <!-- Personal Information -->
    <fieldset class="second-section">
      <legend>Personal Information</legend>
      <label for="dob">Birth Date</label>
      <input type="date" id="dob"> <br><br>
      <label for="gender">Gender ??</label>
      <input list="genders" name="gender" id="gender">
      <datalist id="genders">
      <option value="female">
      <option value="male">
      <option value="other">
      </datalist><br><br>
   <div class="proficiency">
      <label for="profeciency">Proficiency</label>
      <input type="range" value="4" max="10" id="profeciency" name="profeciency">
   </div>

    </fieldset>
   <!-- Preferred Language -->
   <div class="terms">
      <input type="checkbox" id="scales" name="scales" class="checkbox">
      <label for="scales">I have read and agree to the terms and conditions</label>
   </div>
    <button>Submit</button>
</form>
</div>
</body>
</html>HTML Code

admin 發表於 2022-8-16 16:47:33

* {
font-family: 'Montserrat', sans-serif;
}

body {
height: 80vh;
margin-top: 5rem;
background-image: url("https://images.unsplash.com/photo-1595675024853-0f3ec9098ac7?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxzZWFyY2h8Nnx8Y29kaW5nJTIwYm9vdGNhbXB8ZW58MHx8MHx8&auto=format&fit=crop&w=500&q=60");
background-repeat: no-repeat;
background-position: center;
background-size: cover;
padding: 10px;
}

.form {
background-color: #fff;
border-radius: 5px;
padding: 15px 25px;
width: 80%;
margin: 0 auto;
}

.checkbox {
width: 20px !important;
}

.first-section input {
width: 85%;
height: 25px;
margin-left: 5px;
}

.second-section input{
width: 80%;
height: 25px;
margin-left: 5px;
}

.form h1, p {
text-align: center;
}
button {
border: none;
color: white;
background: #1560BD;
padding: 8px 25px;
border-radius: 5px;
display: block;
margin: 20px auto 10px auto;
width: 120px;
}

.second-section {
margin-top: 15px;
}

.proficiency {
display: flex;
align-items: center;
}

.terms {
margin-top: 15px;
display: flex;
align-items: center;
}CSS Code
頁: [1]
查看完整版本: HTML5 : Forms