How can i improve the look of my table easily?

S

salmondays2000

I am creating a simple HTML table with a variable number of rows as the
information is SELECTed from a MySQL database.

The information is laid out nicely in the table but the table itself
looks a bit.... ummm... eighties.... and doesn't fit in with the rest
of my web page.

How can I make my table look nicer? I've heard of CSS but am unsure if
CSS can be applied to just one table, leaving the rest of my site/pages
unaffected.

Any ideas, suggestions or pointers from you guys would be very helpful.

Thanks!

Sam Day.
 
B

Barbara de Zoete

I am creating a simple HTML table with a variable number of rows as the
information is SELECTed from a MySQL database.

How can I make my table look nicer? I've heard of CSS but am unsure if
CSS can be applied to just one table, leaving the rest of my site/pages
unaffected.

If you set the styles for the table specifically, they shouldn't effect
other parts of the page. If you want to target one table, single it out by
giving it a class.

For the first option all you need are the selectors table, th, td (maybe a
smart use of thead th, tfoot th and col). For the second option, you could
use a selector like table#smartlooking to make it look different from
other tables in your site.

A rather simple example with html 4.01 strict and css 2.

markup:

<table id="prices" summary="example table, two columns; first
description of product, secondly the price of the product">
<colgroup><col id="description"><col id="price"></colgroup>
<thead>
<tr>
<th>product description</th>
<th>product price<span>$/ea.</span></th>
</tr>
</thead>
<tfoot>
<tr>
<th colspan="2">
Using styles to set indentation at the decimal point!
</th>
</tr>
</tfoot>
<tbody>
<tr>
<td>First flight in a glider, with a skilled pilot as your
host</td>
<td>40.00</td>
</tr>
<tr>
<td>Three flights with an instructor, as a 'mini course' to see if
gliding is something you like</td>
<td>110.00</td>
</tr>
<tr>
<td>First year membership, forty flights included, liablility
insurance included</td>
<td>1,000.00</td>
</tr>
</tbody>
</table>

styles:

table {
border:2px outset; }

col#description {
width:28em; }

col#price {
width:9em;
text-align:right; }

th, td {
border: 2px inset;
padding:.2em .3em; }

thead {
font-family: "Arial MS", Arial, sans-serif;
font-size:1.3em; }

th {
white-space:nowrap;
vertical-align:top; }

th span {
display:block;
font-size:1.1em;
font-weight:normal; }

--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'
 
S

Sam

Thanks for the quick response.

How do I actually use the 'styles' section? Should this be a separate
file in my web directory?

And, if so, how does the html reference this file?

As I mentioned, I've heard of CSS but have not actually used it yet...

Thanks for any additional info!

Sam Day.
 
B

Barbara de Zoete

How do I actually use the 'styles' section? Should this be a separate
file in my web directory?

Can be, but is not necessary.
And, if so, how does the html reference this file?

As I mentioned, I've heard of CSS but have not actually used it yet...

You found this usenet newsgroup through Google. Try googling for some
answers then. There are some keywords in my post. Although I'm not sure
since I can't see my post anymore. Because you failed to quote properly:
<URL:http://www.safalra.com/special/googlegroupsreply/>

Anyway, here is a starter:
for styles: <URL:http://www.w3.org/MarkUp/Guide/Style.html>
for markup: <URL:http://www.w3.org/MarkUp/Guide/>

You can google not only the web, but also this group and probably others:
<URL:http://groups.google.com/group/comp.infosystems.www.authoring.html>
<URL:http://groups.google.com/group/comp.infosystems.www.authoring.styles>

--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'
 
S

Sam

Although I'm not sure
Please accept my apologies for this.

Thanks very much for your advice so far. I'll ensure that I quote when
posting in future.

Very best regards,

Sam Day.
 
B

Barbara de Zoete

Please accept my apologies for this.

Thanks very much for your advice so far. I'll ensure that I quote when
posting in future.

Thank you for this response. It is quite refreshing to see someone conform
to the netiquette this quick.

You're welcome to ask any further questions of course.



--
,-- --<--@ -- PretLetters: 'woest wyf', met vele interesses: ----------.
| weblog | http://home.wanadoo.nl/b.de.zoete/_private/weblog.html |
| webontwerp | http://home.wanadoo.nl/b.de.zoete/html/webontwerp.html |
|zweefvliegen | http://home.wanadoo.nl/b.de.zoete/html/vliegen.html |
`-------------------------------------------------- --<--@ ------------'
 
J

Jukka K. Korpela

The information is laid out nicely in the table but the table itself
looks a bit.... ummm... eighties.... and doesn't fit in with the rest
of my web page.

You could get specific help with a specific table if you posted the specific
URL. After all, different tables need different styling.
 
S

Sam

You could get specific help with a specific table if you posted the specific
Thanks! But there's no need.

After all the helpful posts on this thread, I have managed to make my
table look very decent indeed! :eek:)

For anyone else that's looking to dabble with CSS and tables, have a
look here: http://www.somacon.com/p141.php

This handy web page allows you to change the look of a table in real
time. You can then copy the resulting CSS code into a .CSS file which
you reference from your page containing the table in the usual way.
Very useful!

Thanks again to everyone,

Sam Day.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top