JSFiddle - React, Tailwind, and code Playground
by evon0306
HTML
<script src="https://kit.fontawesome.com/41e2a8dba7.js" crossorigin="anonymous"></script>
<label for="name">姓名:<input id="name" text="text" placeholder="王小明"/></label>
<button class="order" onclick="order()">
<i class="fa-regular fa-pen-to-square"></i>
<div>我要訂購</div>
</button>
<button class="industry" onclick="industry()">
<i class="fa-solid fa-industry"></i>
<div>認識工廠</div>
</button>
CSS
* {
padding: 0;
margin: 0;
box-sizing: border-box;
border: none;
}
label {
margin: 1rem;
display: flex;
align-items: center;
font: 1.2em sans-serif;
padding: 10px;
}
label #name {
background-color: rgb(196, 196, 196);
color: rgba(0, 99, 56, 0.859);
font-size: 1.1em;
width: 250px;
border-radius: 5px;
padding: 5px;
}
button {
height: 130px;
width: 130px;
padding: 1.5rem;
margin-left: 1rem;
border-radius: 50%;
background-color: rgb(255, 255, 255);
transition: all 0.3s ease;
box-shadow: 0 0 7px rgba(0, 0, 0, 0.43);
}
button:hover {
background-color: rgba(0, 99, 56, 0.859);
color: white;
}
.order {
margin-left: 2.5rem;
}
.order i {
font-size: 2.5rem;
margin-bottom: 0.4rem;
}
.order div {
font: 1.5em sans-serif;
}
.industry {
margin-right: 2.5rem;
}
.industry i {
font-size: 2.5rem;
margin-bottom: 0.4rem;
}
.industry div {
font: 1.5em sans-serif;
}
JavaScript
function order()
{
var name = document.getElementById('name').value;
alert(name+"您好!謝謝您對我們的衣服有興趣!請致電 0987-654-321,會有專人提供您報價!");
}
function industry()
{
alert('我們工廠位於新北市,通過國際 ISO9001 認證,品質讓您放心!');
}