...

View Full Version : Stylesheet or inline styles for my table?



d_m
05-29-2009, 03:30 PM
I am currently developing a website and i need to display spreadsheets of data, so i am doin this using tables. I have it all set up and am ready to style it, mainly altering background colours, and font properties such as weight, color and size and the tables have different width. I have many different tables, one being used many times.

Would like some advice on how to style these, usually id do it using inline styles, but i found myself repeating things lots. For example one table is displaying a simple calendar of events grouped by each month. i felt that as the row containing the month name was styled the same for each month, but different from the rest of the data in the table i was repeating the same code for each month. Would it be simpler to style my tables using an external style sheet using table id, and tr id? or just carry on with the inline styles? I have attempted using the style sheet but I have now run into problems.

I havent got much experience with tables as i generally stay clear from them

Thanks

udjamaflip
05-29-2009, 03:33 PM
stylesheet, always stylesheet but IE6 is known for ignoring CSS applied to tables on certain things like width, specifying col width and valign would probably be best left inline, but anything else like colouring fontsizes etc should be in a stylesheet :thumbsup:

d_m
05-29-2009, 03:42 PM
so i would be right in what ive done so far:

HTML:
table id="events">
<tr id="title">
<td>Date</td>
<td>Event</td>
<td>Venue</td>
</tr>

<tr id="month">
<td colspan="5">&nbsp;January</td>
</tr>
<tr>
<td>Sunday 18<sup>th</sup></td>
<td>RTV</td>
<td>Fetteresso</td>
</tr>.......

STYLESHEET:
#events {
width:780px;
border:none;
}

#title {
color:#A5E543; /* green */
font-weight:bold;
}

#month {
background-color:#A5E543; /* green */
color:#000000; /* black */
font-weight:bold;
}

d_m
05-29-2009, 04:05 PM
stylesheet, always stylesheet but IE6 is known for ignoring CSS applied to tables on certain things like width, specifying col width and valign would probably be best left inline, but anything else like colouring fontsizes etc should be in a stylesheet :thumbsup:

I have went ahead and done this and when validating the html it gave a fair number of errors



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum