เวลาที่เราเขียนเอกสารอธิบายโปรแกรม แล้วมีเรื่องพูดถึง การกดคีย์บอร์ด คีย์ลัด Hot Key ถ้าเราสามารถทำให้เป็นปุ่มสไตล์เหมือนคีย์บอร์ดจริง ๆ อยู่บนหน้าเว็บ จะทำให้ผู้อ่านเห็นภาพ และเข้าใจง่ายขึ้น

เช่น เราสามารถเขียนว่า กดปุ่ม Ctrl + Alt + Del บน Keyboard วิธีการก็คือ ใน ภาษา HTML จะมี tag kbd อยู่แล้ว เราแค่นำมาใส่รอบ ตัวอักษรที่จะอยู่บนปุ่มไว้ เช่น

<kbd>Esc</kbd>

กด Save Draft และ Preview ดู ถ้ายังไม่แสดงเป็นปุ่ม แสดงว่า Theme ที่เราใช้อยู่ ไม่มีการกำหนด CSS ไว้สำหรับ tag kbd ให้เราไปกำหนดสไตล์ CSS เพิ่มไว้ใน Theme ที่เราใช้อยู่ ใน wp-admin / appearance / Edit CSS ดังนี้

kbd {
	background: #eaeaea;
	border: 1px solid #ccc;
	border-radius: 5px;
	margin: 0 .1em;
	padding: .25em;
}

เมื่อแก้ไขเรียบร้อยแล้ว ก็จะเห็นเป็นปุ่มขึ้นมา Esc

แชร์ให้เพื่อน:

Surapong Kanoktipsatharporn on FacebookSurapong Kanoktipsatharporn on LinkedinSurapong Kanoktipsatharporn on Rss
Surapong Kanoktipsatharporn
Solutions Architect at Bua Labs
The ultimate test of your knowledge is your capacity to convey it to another.

Published by Surapong Kanoktipsatharporn

The ultimate test of your knowledge is your capacity to convey it to another.