วิธีการ - ตารางราคาที่ตอบสนอง
เรียนรู้วิธีสร้างตารางราคาแบบตอบสนองด้วย CSS
- ขั้นพื้นฐาน
- $ 9.99 / ปี
- พื้นที่เก็บข้อมูล 10GB
- 10 อีเมล
- 10 โดเมน
- แบนด์วิดธ์ 1GB
- ลงชื่อ
- มือโปร
- $ 24.99 / ปี
- พื้นที่เก็บข้อมูล 25GB
- 25 อีเมล
- 25 โดเมน
- แบนด์วิดธ์ 2GB
- ลงชื่อ
- พรีเมี่ยม
- $ 49.99 / ปี
- พื้นที่เก็บข้อมูล 50GB
- 50 อีเมล
- 50 โดเมน
- แบนด์วิดธ์ 5GB
- ลงชื่อ
วิธีสร้างตารางราคาที่ปรับเปลี่ยนตามอุปกรณ์
ขั้นตอนที่ 1) เพิ่ม HTML:
ตัวอย่าง
<div class="columns">
<ul class="price">
<li
class="header">Basic</li>
<li class="grey">$ 9.99 /
year</li>
<li>10GB Storage</li>
<li>10 Emails</li>
<li>10 Domains</li>
<li>1GB Bandwidth</li>
<li class="grey"><a href="#"
class="button">Sign Up</a></li>
</ul>
</div>
ขั้นตอนที่ 2) เพิ่ม CSS:
ตัวอย่าง
* {
box-sizing: border-box;
}
/* Create
three columns of equal width */
.columns {
float: left;
width: 33.3%;
padding: 8px;
}
/* Style the list */
.price {
list-style-type: none;
border: 1px solid #eee;
margin: 0;
padding: 0;
-webkit-transition:
0.3s;
transition: 0.3s;
}
/* Add shadows on hover */
.price:hover {
box-shadow: 0 8px
12px 0 rgba(0,0,0,0.2)
}
/* Pricing header */
.price .header {
background-color: #111;
color: white;
font-size: 25px;
}
/* List
items */
.price li {
border-bottom: 1px solid #eee;
padding: 20px;
text-align: center;
}
/* Grey list item */
.price .grey {
background-color: #eee;
font-size: 20px;
}
/* The "Sign Up" button */
.button {
background-color: #04AA6D;
border: none;
color: white;
padding: 10px 25px;
text-align: center;
text-decoration: none;
font-size: 18px;
}
/* Change the width of the three columns to
100%
(to stack horizontally on small screens) */
@media only screen and (max-width: 600px) {
.columns {
width: 100%;
}
}