JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=
, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="/index.css">
<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=Noto+Sans+TC:wght@100;400&display=swap" rel="stylesheet">
</head>
<body>
<div class="order">
<h1 class="h1tag">- ONLINE ORDER -</h1>
<div class='name'>
<label for="">姓名 </label>
<input id='name' type="text" placeholder="請輸入姓名..." required>
</div>
<div class='card'>
<button onclick="myFunction()">我要訂購</button>
<button onclick="myFactory()">認識工廠</button>
</div>
</div>
<script src="/index.js"></script>
</body>
</html>
CSS
* {
padding: 0;
margin: 0;
background: lightblue;
font-family: 'Noto Sans TC', sans-serif;
}
.h1tag {
margin-top: 20px;
display: flex;
align-items: center;
justify-content: center;
color: white;
}
.name {
margin-top: 20px;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
}
.name>input {
border: 0;
border-radius: 50px;
padding: 2px 10px;
background-color: white;
}
.card {
display: flex;
align-items: center;
justify-content: center;
}
button {
margin: 20px;
width: 150px;
padding: 10px;
background: lightgray;
color: white;
border-radius: 50px;
border: 2px solid gray;
}
button:hover {
background: white;
color: lightblue;
border: 2px dashed lightblue;
font-weight: 800;
}
JavaScript
function myFunction() {
var name = document.getElementById('name').value;
alert(name + '您好!!謝謝您對我們的衣服有興趣!請致電 0987-654-321,會有專人提供您報價!');
}
function myFactory() {
var name = document.getElementById('name').value;
alert(name + '您好!!我們工廠位於新北市,通過國際 ISO9001 認證,品質讓您放心!');
}