گروه مقاله : HTML 4
تاريخ انتشار : 1394/02/17 - 11:58
كد :390

عناصر فرمت دهی متن در HTML

در فصل قبل در مورد استفاده از خاصیت Style صحبت کردیم.
تگ هاي فرمت دهي  در HTML 
تگ <b> متن را bold می کند.
مثال :
<!DOCTYPE html>
<html>
<body>
<p>This text is normal.</p>
<p><b>This text is bold.</b></p>
</body>
</html>
نتیجه :
.This text is normal
 
.This text is bold
تگ <strong> نتیجه ای شبیه <b> می دهد ولی با کمی تفاوت:
یعنی  متن طوري نمايش داده می شود که کاربر بفهمد متن مهم است.
مثال :
<!DOCTYPE html>
<html>
<body>
<p>This text is normal.</p>
 
<p><strong>This text is strong</strong>.</p>
</body>
</html>
 
 
نتیجه :

This text is normal.

This text is strong.

فرمت های Italic و Emphasized 
 
تگ<i> در HTML متن را  Italic می کند.
مثال :
<!DOCTYPE html>
<html>
<body>
<p>This text is normal.</p>
<p><i>This text is italic.</i></p>
</body>
</html>
نتیجه :

.This text is normal

.This text is italic
تگ  <em>نتیجه ای شبیه <strong> می دهد با این تفاوت که متن را طوري نمايش می دهد که کاربر بفهمد متن مهم است.
 
مثال :
<!DOCTYPE html>
<html>
<body>
<p>This text is normal.</p>
<p><em>This text is emphasized.</em></p>
</body>
</html>
 
نتیجه :
 

This text is normal.

This text is emphasized.

نکته :
امروزه تمام مرورگرهاي اصلي، متن strong شده را به صورت bold و متن با فرمت em را به صورت italic نمايش مي دهند.
با اين وجود، اگر مرورگري بخواهد متون با فرمت strong را highlight کند متون bold شده را highlight نمي کند.
 
فرمت small در HTML 
 
تگ<small> نوشته را کوچک می کند :
<!DOCTYPE html>
<html>
<body>
<h2>HTML <small>Small</small> Formatting</h2>
</body>
</html> 
نتیجه :

HTML Small Formatting

فرمت Marked در HTML 
 
تگ <mark> متن را هایلایت می کند:
 
<!DOCTYPE html>
<html>
<body>
<h2>HTML <mark>Marked</mark> Formatting</h2>
</body>
</html>
نتیجه :

HTML Marked Formatting

فرمت Deleted در HTml 

تگ <del> متن را به صورت Deleted (روی آن خط کشیده شده) نمایش می دهد.
 
<!DOCTYPE html>
<html>
<body>
<p>The del element represent deleted (removed) text.</p>
<p>My favorite color is <del>blue</del> red.</p>
</body>
</html>
نتیجه :

.The del element represent deleted (removed) text

.My favorite color is blue red
فرمت Inserted در HTML 
 
تگ <ins> متن را به صورت inserted (زیر خط دار) نمایش می دهد.
<!DOCTYPE html>
<html>
<body>
<p>The ins element represent inserted (added) text.</p>
<p>My favorite <ins>color</ins> is red.</p>
</body>
</html>
نتیجه :
 

.The ins element represent inserted (added) text

.My favorite color is red

فرمت Subscript در HTML 
 
تگ <sub> متن را به صورت subscripted نمايش مي دهد.
<!DOCTYPE html>
<html>
<body>
<p>This is <sub>subscripted</sub> text.</p>
</body>
</html>
نتیجه :
 
.This is subscripted text
 
فرمت Superscript در HTML 
 
تگ  <sup> متن را به صورت superscripted نمايش مي دهد.
 
<!DOCTYPE html>
<html>
<body>
<p>This is <sup>superscripted</sup> text.</p>
</body>
</html>
نتیجه :
 
.This is superscripted text
 
تگ هاي مربوط به قالب بندي متن در HTML 
 
تگ توضیحات
<b> نمایش می دهد bold متن را به صورت
<em>  تأکيد شده) نمایش می دهد) emphasized متن را به صورت مورب
<i> نمایش می دهد italic متن را به صورت مورب یا
<small> نمایش می دهد small متن را به صورت
<strong> نمایش می دهد strong متن را به صورت ضخیم یا 
<sub> نمایش می دهد subscripted متن را به صورت
<sup> نمایش می دهد superscripted متن را به صورت
<ins> زیر خط دار) نمایش می دهد) inserted متن را به صورت
<del>  روی آن خط کشیده ) نمایش می دهد) deleted متن را به صورت
<mark> متن را هایلایت می کند
نظرات كاربران :