جلسه هشتم فونت ها در HTML
14 دی 1402 1402-10-15 15:21جلسه هشتم فونت ها در HTML
جلسه هشتم فونت ها در HTML
تگ <font> نباید استفاده شود
تگ <font> در HTML 4 رایج نیست و در HTML 5 حذف شده است.
کنسرسیوم World Wide Web یا (w3c) تگ <font> را از دستوراتش حذف کرده است.
در HTML 4، باید از CSS (یا style sheetها) برای تعیین خصوصیات نمایش عناصر استفاده کرد.
مثال زیر نشان می دهد که چگونه HTML با تگ <font> کار می کند.
مثال (فونت ها در HTML)
<!DOCTYPE html>
<html>
<body>
<p><font size="3" color="red">This is some text!</font></p>
<p><font size="2" color="blue">This is some text!</font></p>
<p><font face="verdana" color="green">This is some text!</font></p>
<p><strong>Note:</strong> The font element is not supported in HTML5. Use CSS instead.</p>
</body>
</html>
خروجی:
راه درست قالب بندی – با Style ها
Set the font of text
این مثال نحوه تنظیم فونت متن را نشان می دهد.
<html>
<body>
<h1 style="font-family:verdana">This is a heading</h1>
<p style="font-family:courier">This is a paragraph.</p>
</body>
خروجی:
Set the font size of text
این مثال نحوه تنظیم سایز فونت را نشان می دهد.
<html>
<body>
<h1 style="font-size:200%">This is a heading</h1>
<p style="font-size:110%">This is a paragraph.</p>
</body>
</html>
خروجی:
رنگ بندی در HTML
<html>
<body>
<h1 style="color:blue">This is a heading</h1>
<p style="color:red">This is a paragraph.</p>
</body>
</html>
خروجی:
<html>
<body>
<p style="font-family:verdana;font-size:110%;color:green">
This is a paragraph with some text in it.
This is a paragraph with some text in it.
This is a paragraph with some text in it.
This is a paragraph with some text in it.
</p>
</body>
</html>
خروجی: