View Full Version : Simple HTML table/CSS font question

09-21-2007, 11:55 PM
I've got a site with a LOT of HTML tables (arguments against notwithstanding :) ) Due to requirements...all the tables are different shapes/sizes/colors etc. Now being a newb for the most part...I've ended up with every line of my HTML code for the tables having the font type and size contained within as such:

<td width="40" bgcolor="#00CCFF"> <div align="center"><font size="3" face="Times New Roman">BLAH BLAH</font></div></td>
<td width="431" bgcolor="#00CCFF"> <div align="left"><font size="3" face="Times New Roman">BLAH BLAH</font></div></td>

Having been reading up on CSS...among other things...what is the simplest way to code a CSS page that will allow my tables to have the required font type/size without having it within the HTML code itself?

If this question makes sense...I'd appreciate any/all responses.


09-22-2007, 03:19 AM
I think this should work:

td {
font-size: 12px; // Or whatever size you need it to be... 12px != 3
font-family: Times New Roman, serif;

09-22-2007, 04:48 AM
Actually font-size: medium would be equivalent to "3" so...

td {
font: medium "Times New Roman";

09-22-2007, 05:00 AM
Good point, that code is as simple as it gets!

here's the code to embed it in your <head> tag:

<style type="text/css">
td {
font: medium "Times New Roman";