คุณสมบัติแบบอักษร CSS ใช้เพื่อระบุรูปแบบปกติ ตัวเอียง หรือเฉียงสำหรับข้อความขององค์ประกอบ
ไวยากรณ์
ไวยากรณ์ของคุณสมบัติรูปแบบตัวอักษร CSS มีดังต่อไปนี้ -
Selector {
font-style: /*value*/
} ตัวอย่าง
ตัวอย่างต่อไปนี้แสดงให้เห็นถึงคุณสมบัติแบบอักษร CSS -
<!DOCTYPE html>
<html>
<head>
<style>
h2 {
font-style: italic;
background-color: steelblue;
color: white;
}
p {
font-style: oblique 10deg;
}
</style>
</head>
<body>
<h2>Fortran Tutorial for Beginners</h2>
<p>Fortran, as derived from Formula Translating System, is a general-purpose, imperative programming language.</p>
<p>It is used for numeric and scientific computing.</p>
</body>
</html> ผลลัพธ์
สิ่งนี้ให้ผลลัพธ์ต่อไปนี้ -

ตัวอย่าง
<!DOCTYPE html>
<html>
<head>
<style>
h3 {
font-style: italic;
background-color: mediumpurple;
color: white;
text-align: center;
}
li {
font-family: "Comic Sans MS", cursive;
font-style: oblique 5deg;
}
</style>
</head>
<body>
<h3>Developers Best Practices Tutorial</h3>
<ul>
<li>Documentation is the key</li>
<li>Follow the standards</li>
<li>Write to be Reviewed</li>
</ul>
</body>
</html> ผลลัพธ์
สิ่งนี้ให้ผลลัพธ์ต่อไปนี้ -
