Latest Lists

How to set the font within an list in XHTML?

I'm a complete novice trying to write some xhtml 1.0 transitional script, so I apologize for asking such a simple-minded question. When trying to validate my page on w3c markup validator, I'm running into a error when making an unordered list. The script listed below passes validation - but I want it to display in the following font: <font face="Arial, Helvetica, sans-serif" size="2"></font> My question is where do I add this? Do I have to add the <font> element to each and every <li> line? Or is there a way to just specify the font style once for the entire list? I am opting for the latter, but that is where I am running into trouble in the markup validator. Thank you for your help! Red Unordered List: <ul> <li>Division I <ul> <li>Mr. A, 3 dan, 4-0</li> <li>Mr. B, 3 dan</li> </ul> </li> <li>Division II <ul> <li>Mr. A, 3 dan, 4-0</li> <li>Mr. B, 3 dan</li> </ul> </li> <li>Division III <ul> <li>Mr. A, 3 dan, 4-0</li> <li>Mr. B, 3 dan</li> </ul>

Public Comments

  1. This may be a little scary, but the best way is to use CSS. After Your </head> and before your <body> type this: <style type="text/css"> .arial { font-family:arial; font-size:2em; } </style> If the size is too big or two small, change the number in front of "em" until it looks right. Now, change your <ul> tag so it reads like this: <ul class="arial"> I don't have time to explain it in detail, but basically you are giving your list a class and using a CSS style sheet to define the font you want the list to be. You really should learn CSS - it is part of the XHTML recomendation. Its extremely simple - Yahoo! a tutorial for it. it is so handy - you will love it.
  2. use of the font tag is deprecated in XHTML. Instead of using font you should look to apply styles globally through a Cascading Style Sheet or CSS. Try http://www.w3schools.com/css/default.asp
Powered by Yahoo! Answers