ฝากท่าละดินที่จะสร้างจดหมายอีเมลสำหรับการสื่อสาร

เรียนรู้ว่าจะสร้างจดหมายอีเมลสำหรับการสื่อสาร

สมัครสมาชิกข่าวสารประจำวันของเรา

Lorem ipsum text about why you should subscribe to our newsletter blabla. Lorem ipsum text about why you should subscribe to our newsletter blabla. Lorem ipsum text about why you should subscribe to our newsletter blabla.

亲自试一试

ฝากท่าละดินที่จะทำข่าวข่าวความประชาสัมพันธ์

ขั้นที่ 1 - เพิ่ม HTML

ใช้สิ่งเกี่ยวกับอิเล็กทรอนิกส์ form ซึ่งใช้ในการบันทึกข้อมูลต่างๆ คุณสามารถดูข้อมูลเพิ่มเติมในหลักสูตร PHP ของเรา

ตามมาด้วยการเพิ่มปุ่มยื่นฟอร์มและโค้ดยิ่งต่อไป

<form action="action_page.php">
  <div class="container">
    <h2>Subscribe to our Newsletter</h2>
    <p>Lorem ipsum..</p>
  </div>
  <div class="container" style="background-color:white">
    <input type="text" placeholder="Name" name="name" required>
    <input type="text" placeholder="Email address" name="mail" required>
    <label>
      <input type="checkbox" checked="checked" name="subscribe"> Daily Newsletter
    </label>
  </div>
  <div class="container">
    <input type="submit" value="Subscribe">
  </div>
</form>

第二步 - 添加 CSS:

/* 为表单元素设置样式,使其周围带有边框 */
form {
  border: 4px solid #f1f1f1;
}
/* 为容器添加一些内边距和灰色背景色 */
.container {
  padding: 20px;
  background-color: #f1f1f1;
}
/* 设置输入元素和提交按钮的样式 */
input[type=text], input[type=submit] {
  width: 100%;
  padding: 12px;
  margin: 8px 0;
  display: inline-block;
  border: 1px solid #ccc;
  box-sizing: border-box;
}
/* 为复选框添加外边距 */
input[type=checkbox] {
  margin-top: 16px;
}
/* 设置提交按钮的样式 */
input[type=submit] {
  background-color: #04AA6D;
  color: white;
  border: none;
}
input[type=submit]:hover {
  opacity: 0.8;
}

亲自试一试

相关页面

教程:HTML 表单

教程:CSS 表单