ใน CSS3 (Version 3) สามารถนำฟอนต์ที่ไม่ใช่ฟอนต์มาตรฐานบนเว็บไซต์ (CSS Web Safe Font Combinations) มาใช้บนเว็บไซต์ได้ด้วยการใช้ @font-face Rule โดยเริ่มต้นจากการดาวน์โหลดไฟล์ฟอนต์ประจำมหาวิทยาลัย fonts.zip ซึ่งแต่ละ Web Browser จะสนับสนุนชนิดของไฟล์ฟอนต์ที่แตกต่างกัน ดังนี้ จากนั้นใส่ CSS3 @font-face Rule เพื่อเรียกใช้ไฟล์ฟอนต์ ที่ประกอบด้วยฟอนต์ตัวอักษรปกติ (db_chidlom_xregular) และฟอนต์ตัวอักษรแบบหนา (db_chidlom_xbold) ให้พิจารณาที่อยู่ของไฟล์ฟอนต์ให้ถูกต้อง ตรงกับที่อยู่ไฟล์ฟอนต์จริงบนเว็บไซต์
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
@font-face { font-family: 'db_chidlom_xregular'; src: url('fonts/DB Chidlom X v3.2-webfont.eot'); src: url('fonts/DB Chidlom X v3.2-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/DB Chidlom X v3.2-webfont.woff2') format('woff2'), url('fonts/DB Chidlom X v3.2-webfont.woff') format('woff'), url('fonts/DB Chidlom X v3.2-webfont.ttf') format('truetype'), url('fonts/DB Chidlom X v3.2-webfont.svg#db_chidlom_xregular') format('svg'); font-weight: normal; font-style: normal; } @font-face { font-family: 'db_chidlom_xbold'; src: url('fonts/DB Chidlom X Bd v3.2-webfont.eot'); src: url('fonts/DB Chidlom X Bd v3.2-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/DB Chidlom X Bd v3.2-webfont.woff2') format('woff2'), url('fonts/DB Chidlom X Bd v3.2-webfont.woff') format('woff'), url('fonts/DB Chidlom X Bd v3.2-webfont.ttf') format('truetype'), url('fonts/DB Chidlom X Bd v3.2-webfont.svg#db_chidlom_xbold') format('svg'); font-weight: normal; font-style: normal; } |
สำหรับการเรียกใช้ฟอนต์ประจำมหาวิทยาลัยสามารถเรียกใช้ได้โดยตรงเช่น <h3 style=”font-family:’db_chidlom_xbold’, sans-serif, Arial”>หัวข้อฟอนต์มหาวิทยาลัย</h3> หรือการกำหนดผ่าน Id หรือ Class ผ่าน CSS เช่น
1 2 3 |
.entry-title { font-family: 'db_chidlom_xregular', sans-serif, Arial; } |
ตัวอย่างผลลัพธ์จากการใช้ฟอนต์ประจำมหาวิทยาลัย