Bold and Italics Bold and Italic Text in
Bold and Italics
Bold and Italic Text in XHTML: n We can italicize and bold text in CSS by using the "font-style: italic" and "font-weight: bold" styles. n Another method is to use the <em> ("emphasis") and <strong> tags. n A third method is to use the <i> and <b> tags. These are often seen in older, existing web pages. Avoid using these, as the first two methods are now preferred.
Bold and Italics via CSS: <head> <style type="text/css"> h 2 { font-style: italic; } h 3 { font-weight: bold; } h 4 { font-style: italic; font-weight: bold; } </style> </head> <body> <h 2>Heading in Italics</h 2> <h 3>Heading in Bold</h 3> <h 4>Heading in Bold and Italics</h 4> </body> Heading in Italics Heading in Bold and Italics CSS is the preferred way of styling text in bold and italics.
Bold and Italics via <strong> and <em>: <body> <h 2> <em>Heading in Italics</em> </h 2> <h 3> <strong>Heading in Bold</strong> </h 3> <h 4> <em><strong> Heading in Bold and Italics </strong></em> </h 4> </body> Heading in Italics Heading in Bold and Italics Although considered an acceptable method for making text italic and bold, <em> and <strong> are best reserved for those situations in which there is a semantic (meaningful) difference in the text. For example, <em> is the preferred method when the text to be italicized is a book title, ship name, or foreign phrase.
- Slides: 4