Styling a table

A

={ Advocated }=

Hey there, i have say 20 cells in a table, say 15 of them are all one
background colour, and the other 5 arent.. I want to use css for this, so
how would i go about it?

Cheers
 
A

andy johnson

Hey there, i have say 20 cells in a table, say 15 of them are all one
background colour, and the other 5 arent.. I want to use css for this, so
how would i go about it?

Cheers
Try in stylesheet:
td {background-color:#EEEEFF; border: thin solid black; }
..teedee {background-color:#EECCFF; border: thin solid black; }


<td>&nbsp;</td>
<td class="teedee">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="teedee">&nbsp;</td>

http://www.echoecho.com/csscolors.htm has something on this, among
others.

-
Andy

"There would be a lot more civility in this world if people
didn't take that as an invitation to walk all over you"
- (Calvin and Hobbes)
 
A

={ Advocated }=

Nico Schuyt said:


This is what ive done now so far:
http://homepage.ntlworld.com/c.jones13/Test/NewIndex.htm

It doesnt look very pretty at the moment, the sides also seem to have monged
since ive uploaded..

Anyway, i havent put all sizes etc into css yet, i will once i have an idea
of what it will look like.

The cells with the certain px in are the ones that need to be that size, but
im not sure what to put in all the others?

Any ideas? See the one at the bottom, the copyright thing, would it be best
to set that to 100% ? or would that not work, because then im thinking it
would stretch to the bottom of the browser.. Any help would be apreciated
 
E

Els

={ Advocated }= said:
This is what ive done now so far:
http://homepage.ntlworld.com/c.jones13/Test/NewIndex.htm

It doesnt look very pretty at the moment, the sides also seem to have monged
since ive uploaded..

Anyway, i havent put all sizes etc into css yet, i will once i have an idea
of what it will look like.

I still think it's better to do that now, because right now
the page doesn't validate. And what doesn't validate, might
have a 'different' effect in different browsers, which will
have you redoing loads of stuff again, after you got it the
way you wanted it.
The cells with the certain px in are the ones that need to be that size, but
im not sure what to put in all the others?

Let them size with the content?
Any ideas? See the one at the bottom, the copyright thing, would it be best
to set that to 100% ? or would that not work, because then im thinking it
would stretch to the bottom of the browser.. Any help would be apreciated

100% of what? No, give it a height, or better, let it be the
height the text in the footer needs (my opinion), and let
the rest of the page free. If you want the footer at the
bottom of the window, a seperate div for the footer might do
what you want, which I think is easier to accomplish with
Nico's structure than with the table. But keep in mind, that
if there isn't much content, people don't like to scroll all
the way down just to see a copyright note. Personally, I'd
put the footer on the bottom of the page, not at the bottom
of the window.
 
N

Nico Schuyt

={ Advocated }= said:
"Nico Schuyt" wrote

Ehh, forgive me my ignorance, but why didn't you just started with the
advice of Els? At least that validates.
And don't try so hard to make everything fixed in px. I (almost) never
specify a height but let it depend on the content.
Also it's in fact useless: If a visitor decides to increase the font (IE
View->Text size-> Large) your cell of 19px will be 60px or something like
that.
Nico
 
A

={ Advocated }=

Nico Schuyt said:
Ehh, forgive me my ignorance, but why didn't you just started with the
advice of Els? At least that validates.
And don't try so hard to make everything fixed in px. I (almost) never
specify a height but let it depend on the content.
Also it's in fact useless: If a visitor decides to increase the font (IE
View->Text size-> Large) your cell of 19px will be 60px or something like
that.
Nico

Some of my cells dont have any text, just images etc for the styling.. And
mine is virtually the same as ells, except i use external css files instead
of in the html doc, and i wanted to do it myself
 
E

Els

={ Advocated }= said:
Some of my cells dont have any text, just images etc for the styling..
Which means you don't have to put any height in it, the
image will take care of the height of that particular cell :)
And mine is virtually the same as ells, except i use external css files instead
of in the html doc,

I would too, I just put them in the <head>, to change it
easily. After everything works, I move the whole lot to an
external stylesheet.
and i wanted to do it myself

Fair enough, if you just copy what others do, you won't
understand what you did. (I did use some javascript that
way, and I still don't know what it does and why ;-))
But do what I did: take out from the html everything that
can be done with css, and have the lot validated before you
move to the next step.
 
I

Isofarro

={ Advocated }= said:
Hey there, i have say 20 cells in a table, say 15 of them are all one
background colour, and the other 5 arent..

Is there a reason why 5 cells should have a different background colour than
the others. Are they more important or less important than the other 15
cells?
 
A

={ Advocated }=

W

William Tasso

={ Advocated }= said:
Well they are different colours because thats the way i want them,
else it would be a plain site with one colour

what does it do? the colour, what does it signify?
 
A

={ Advocated }=

Els said:
Which means you don't have to put any height in it, the
image will take care of the height of that particular cell :)


I would too, I just put them in the <head>, to change it
easily. After everything works, I move the whole lot to an
external stylesheet.


Fair enough, if you just copy what others do, you won't
understand what you did. (I did use some javascript that
way, and I still don't know what it does and why ;-))
But do what I did: take out from the html everything that
can be done with css, and have the lot validated before you
move to the next step.

Ive been putting most things into css now, yet my page looks totally, whats
the word, BAD! :S
if you see it in IE:
http://homepage.ntlworld.com/c.jones13/Test/NewIndex.htm
you will see a gap between the 2 logo's which i cant work out, and if you
look at the page in netscape, there is no gap, yet all the extra
things(those lines, on the lighter orange) are just totally not aligned,
like they are supposed to be, with the css file.. Im going from bad to worse
:S

Help would be apreciated
 
T

Toby A Inkster

={ Advocated }= said:
because thats how i want it, end of discussion

The others were asking because there are different techniques that are
appropriate for differtent scenarios:

1. You want the top row of a table to be a different colour because it is
the row headings.

Solution: Structure your table so that row headings use <th> instead of
<td> and then style th and td differently in your style sheet.

2. You want to point out that certain listings are more significant than
others.

Solution: Wrap the contents of the table cells in <strong>...</strong>
tags and then style strong with display:block; height: 100%;
color:whatever; background-color: whatever;.

3. You want to change the background colour for purely presentational
desires.

Solution: set a class for the table cells you want and then style this
class in CSS.
 
R

rf

Toby A Inkster said:
The others were asking because there are different techniques that are
appropriate for differtent scenarios:

<snip scenarios>

It is also possible to construct a style rule that selects a <tr>.

Cheers
Richard.
 
W

William Tasso

={ Advocated }= wrote:

[CSS]
Help would be apreciated

I daresay it might be.

however, I understand from another of your posts in this thread that you are
no longer interested.

<q>end of discussion</q src="={ Advocated }=">

Good bye.
 
E

Els

={ Advocated }= said:
Ive been putting most things into css now, yet my page looks totally, whats
the word, BAD! :S
if you see it in IE:
http://homepage.ntlworld.com/c.jones13/Test/NewIndex.htm

What I see now (22.13 hrs CET) is not what it looked like
when you wrote this message, is it? All I see now, is the
images, (no logo's, therefore: no gap) and some text white
on white, which I don't see if I don't hightlight it.
Looking at the source code, I see that you still have
heights in the td's, and that the various classes you
defined, are not to be found back in the stylesheet.
you will see a gap between the 2 logo's which i cant work out, and if you
look at the page in netscape, there is no gap, yet all the extra
things(those lines, on the lighter orange) are just totally not aligned,
like they are supposed to be, with the css file.. Im going from bad to worse

Looks more like you're going around in circles.
Maybe you forgot to link a stylesheet to the page? All these
classes I see in the source code, are not in toplinks.css.
 
A

={ Advocated }=

Els said:
What I see now (22.13 hrs CET) is not what it looked like
when you wrote this message, is it? All I see now, is the
images, (no logo's, therefore: no gap) and some text white
on white, which I don't see if I don't hightlight it.
Looking at the source code, I see that you still have
heights in the td's, and that the various classes you
defined, are not to be found back in the stylesheet.
worse

Looks more like you're going around in circles.
Maybe you forgot to link a stylesheet to the page? All these
classes I see in the source code, are not in toplinks.css.

yea sorry about that, thats my *old* page, i uploaded and overwrite the
recent one by mistake :S
 

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,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top