PDA

View Full Version : Tables


camaro86us
05-05-2003, 09:16 PM
Is there a way to change the font style,color, size in a table?? I have looked everywhere and I can't find the answer. Please Help

cg9com
05-05-2003, 09:23 PM
You can simply add any type of formatting INSIDE the table data element. Using elements locally or through external/embedded CSS.

HTML (http://www.w3schools.com/html/):

<table>
<tr>
<td>
<font size="5">
formatted text
</font>
</td>
</tr>
</table>


CSS (http://www.w3schools.com):

<style type="text/css">
td.formatted { font:bold 100% verdana; color:yellow; }
</style>

...


<table>
<tr>
<td class="formatted">
formatted text
</td>
</tr>
</table>


hope this helps,

Nightfire
05-05-2003, 09:24 PM
<style>
td{
color:#ff0000;
font-style:italic;
font-size:0.9em;
}
</style>

<edit>Bah :( Too slow :p </edit>

Eddyd84
05-05-2003, 09:26 PM
Use CSS! This code goes in the <head> portion of your HTML file.
<style>
<!--
table, td {
font-family: sans-serif;
font-size: 125%;
color: #003366;
font-weight: bold;
}
-->
</style>
I hope this helps. :D
<edit>Too slow too</edit>
Peace,
Ed

cg9com
05-05-2003, 09:26 PM
lol

I think the point we are trying to make is use CSS.

:thumbsup:

giz
05-11-2003, 02:10 PM
Stick the code in external CSS file, then you can use the same code on every page, only have one copy to alter to change the style of the whole website, and have the style sheet cached once per visitor rather than served per page.


In CSS you must have units with all of your numbers, so one of either px, pt, em, %, or # is always required.


You should export the CSS to an external file and call it with a one line instruction in the <head> section:
<link type="text/css" rel="stylesheet" src="/path/file.css">

External CSS files must not contain any HTML tags or code.

BloodXero
05-11-2003, 04:40 PM
ya CSS is fine and dandy and cool to use but what if (very rare i know) some really out of date person with something like IE 2 came onto your site? what would happen to the CSS do you think. ya probably alot of things within the table itself would dissappear if you did that but CSS would most likely be a goner. say some old granny in the depths of Canada.

pardicity3
05-11-2003, 07:29 PM
BloodXero -

That is why you use semantic markup that makes sense. That way, if CSS cannot be viewed, your site will degrade wonderfully well. I use css on my site and it looks perfectly fine when viewed in some "ancient" browser such as lynx. Take a look! (http://www.delorie.com/web/lynxview.cgi?url=http%3A%2F%2Fwww.mikesadventures.net)

<edit>
That is why you use semantic markup that makes sense
-- Can you say, redundantly redundant?
</edit>

BloodXero
05-11-2003, 08:07 PM
ya but a look at this (http://www.delorie.com/web/lynxview.cgi?url=http%3A%2F%2Fwww.allegro.cc). now go to the real site Allegro (http://www.allegro.cc) and compare.

Vladdy
05-11-2003, 08:30 PM
Originally posted by BloodXero
ya but a look at this (http://www.delorie.com/web/lynxview.cgi?url=http%3A%2F%2Fwww.allegro.cc). now go to the real site Allegro (http://www.allegro.cc) and compare.
ROFLMAO, you just proved that using sensible mark up with CSS makes site accessible by any device, while using tables may make it look OK in graphical browsers, but makes it a complete mess in everything else.

BloodXero
05-11-2003, 11:45 PM
that sentence made no sense.

liorean
05-12-2003, 12:04 AM
On the contrary - he was perfectly clear and accurate to a point.

You just proved two things:
- Tables designs might look well in most graphical browsers, but it looks awful on other devices.
- Semantic tags with css for presentation makes the site accessible (ie. readable and well-structured) on any device, while the css provides the presentation that makes it look good.

He just said that in a single sentence instead of several.

cg9com
05-12-2003, 03:07 AM
indeed. :D

zoobie
05-12-2003, 04:03 AM
I really don't think css is quite there yet...as it won't even display in NS4, has trubble with IE5 mac, needs several workarounds, estimated to work in only 70% of browsers used, etc. I just came from a css site that looked horrible in IE6! Although I'm studying css display now, I'll have to wait another 18 months or so.
Tables, on the other hand, seem a lot more dependable. IE is the most common browser used...and if NS makes up 4%, you can imagine what other browsers usage is. Only the geeks use the text based browsers and they aren't the types that surf pages much. Sorry guys..ha ha! :D

bradyj
05-12-2003, 06:11 AM
IE 5 mac has proved to be junk to all of us mac geeks...

CSS really has that low of a percentage to work on browsers? And I was just hoping to dump tables in the near future, say, next project...:(

cg9com
05-12-2003, 08:30 AM
CSS is supported in NS4, albeit a little buggy.
Valid markup, with CSS, will degrade well in older browsers given you have good document structure and so on.

I say lose the tables. :D

ronaldb66
05-12-2003, 01:21 PM
Zoob,

as it won't even display in NS4, has trubble with IE5 mac, needs several workarounds, estimated to work in only 70% of browsers used, etc.
That's not caused by CSS, but by crappy old browsers that don't support well thought out standards designed to get rid of the need for designing for browsers. Does your local gas station still sell coal? I don't think so.

bradyj
05-12-2003, 04:50 PM
Bless your heart, the tables are gone.

However, I have yet to find good documentation, tutorials, or a clean explanation on how to degrade a website properly without the use of tables? From what I've seen, all my pages just have their images jumbled on top of each other...

ronaldb66
05-13-2003, 09:31 AM
Bradyj,

What cg9com already mentioned: it's all about document structure.
Imagine you want to build a page using nothing but standard HTML, no CSS, no - deprecated - attributes or elements (like "font"... :mad: ): it's going to be drab, it's going to be plain, it's going to be in the standard font, but it should still be legible and usable. HTML offers enough ways to create a well-structured document, with images.
Once you've arrived there, like icing on the cake you "sprinkle" over CSS as adornment to bring in color, specific fonts, alignment, borders, backgrounds, etc. to achieve the visually appealing page you envisaged at the start, but it will still have a sound document structure.

(To be totally honest: certain parts of the structure will be added with CSS in mind, like divs, but the structure will still be sound.)

bradyj
05-13-2003, 05:26 PM
Ok that makes sense, and is a good way for me to focus building my sites from now on... do the basics (no deprecated elements, no prettiness) in the html - make sure it is viewable. Then pop the CSS in to add the character --- to paraphrase.

thanks ronaldb66 for the clear answer!:thumbsup: