HighDots Forums  

Widths and padding / margin..

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Widths and padding / margin.. in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andrew Thompson
 
Posts: n/a

Default Widths and padding / margin.. - 11-02-2003 , 08:35 AM






I am developing a Periodic Table of the Elements
as<DIV>s ..(chuckle - just kidding!) a <TABLE>
at http://www.physci.org/test/chem/,
or rather, the table itself is..
http://www.physci.org/test/chem/ptoe.html

It contains valid HTML and CSS
(checked 'moments' ago).

Am testing in IE 6 on XP. My questions..
The 'width' value of table cells seems to have
no effect, can they be set? If so, how?
How can I collapse the gap between cells
containing chemical elements?

TIA

--
Andrew Thompson
http://www.AThompson.info/
http://www.PhySci.org/
http://www.1point1C.org/



Reply With Quote
  #2  
Old   
Kris
 
Posts: n/a

Default Re: Widths and padding / margin.. - 11-02-2003 , 08:51 AM






In article <CC8pb.175895$bo1.105157 (AT) news-server (DOT) bigpond.net.au>,
"Andrew Thompson" <andrew64 (AT) bigNOSPAMpond (DOT) com> wrote:

Quote:
I am developing a Periodic Table of the Elements
as<DIV>s ..(chuckle - just kidding!)
What do we have here?! A friggin' comedian.

Quote:
a <TABLE
at http://www.physci.org/test/chem/,
or rather, the table itself is..
http://www.physci.org/test/chem/ptoe.html
Very nice!

Quote:
It contains valid HTML and CSS
(checked 'moments' ago).
You may want to check again:
<http://validator.w3.org/check?uri=ht...org%2Ftest%2Fc
hem%2Fptoe.html>

Quote:
Am testing in IE 6 on XP. My questions..
The 'width' value of table cells seems to have
no effect, can they be set? If so, how?
Set the width for a cell, using CSS and don't set any width for the
TABLE element, since it's resulting width will be the sum of the width
of the cells.

If you however insist on the TABLE having an explicit width, then what
do you imagine a browser to behave when you set explicit width for cells?

Back in the days of table-layouts, we often had the following situation:

<table width="100%">
<tr>
<td width="200">..</td><td>..</td>
</tr>
</table>

The table would fit itself to the available width of it's container
(often, the browser window), the first cell would be explicitly 200
pixels wide and the third cell would occupy whatever space was left
within the table's boundaries.

Now, imagine:

<table width="100%">
<tr>
<td width="200">..</td><td width="200">..</td>
</tr>
</table>

What would a browser need to do with this? I find it quite reasonable if
a browser ignores the widths on the cells. Now that we do presentational
things with CSS, it is not really that much different.

Quote:
How can I collapse the gap between cells
containing chemical elements?
<table ... cellspacing="0">

--
Kris
kristiaan (AT) xs4all (DOT) netherlands (nl)


Reply With Quote
  #3  
Old   
Lauri Raittila
 
Posts: n/a

Default Re: Widths and padding / margin.. - 11-02-2003 , 09:09 AM



In article Andrew Thompson wrote:
Quote:
I am developing a Periodic Table of the Elements
as<DIV>s ..(chuckle - just kidding!) a <TABLE
at http://www.physci.org/test/chem/,
or rather, the table itself is..
http://www.physci.org/test/chem/ptoe.html

It contains valid HTML and CSS
(checked 'moments' ago).

Am testing in IE 6 on XP. My questions..
The 'width' value of table cells seems to have
no effect, can they be set?
Browser don't do anything as stupid as set all cells 25 em wide, as then
you would get mile long scrollbar.

No sensible browser allows that. You are also using width:100% for table.
How do you expect both happen? If you don't use width:100% for table, and
use small enaugh value for elemenent cell widths (so that whole table
fits viewport), then all cells will be same size. At least in Opera 7.21.

Quote:
How can I collapse the gap between cells
containing chemical elements?
table {border-collapse:collapse;}


--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.



Reply With Quote
  #4  
Old   
Christoph Paeper
 
Posts: n/a

Default Re: Widths and padding / margin.. - 11-02-2003 , 09:10 AM



*Andrew Thompson* <andrew64 (AT) bigNOSPAMpond (DOT) com>:
Quote:
I am developing a Periodic Table of the Elements
as<DIV>s ..(chuckle - just kidding!) a <TABLE
Hey, I once wanted to do the same to test all the features that HTML4 tables
provide, but quickly lost interest.

Quote:
The 'width' value of table cells seems to have no effect, can they be set?
Yes.

Quote:
Applies to: all elements but non-replaced inline elements, table rows, and row groups
OTOH 'margin' doesn't apply to table-cells and the other internal table
elements.

Quote:
If so, how?
With the 'width' property either on the cells ('td' or 'th') or the column
('col' or 'colgroup'). You'll probably not be able to see it with the
automatic table algorithm used by default. Try "table-layout: fixed.

Quote:
How can I collapse the gap between cells containing chemical elements?
border-collapse: collapse;

If you use the value 'separate', you can specify the distance with the
'border-spacing' property. IIRC IE doesn't support the latter.

P.S.: Haven't elements 113 and 114 also been created already?
"Periodic Table of the Elements" should be in 'caption', "(c) Andrew
Thompson, 2003" in 'tfoot' and &copy; exists. It's doubtful that you own
any^Wmuch intellectual property on the data on that page, though.

--
Three things matter in a speech:
who says it, how he says it, and what he says,
and of the three, the last matters least.


Reply With Quote
  #5  
Old   
Lauri Raittila
 
Posts: n/a

Default Re: Widths and padding / margin.. - 11-02-2003 , 09:27 AM



In article Christoph Paeper wrote:

Quote:
With the 'width' property either on the cells ('td' or 'th') or the column
('col' or 'colgroup'). You'll probably not be able to see it with the
automatic table algorithm used by default. Try "table-layout: fixed.
Notice that it won't work well (at all really, when trying to use 25em
width for cells) whitout markup changes, as there is only two fixed width
cells on first row and 3 on total. So <col> elements are needed, at
least.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Saapi lähettää meiliä, jos aihe ei liity ryhmään, tai on yksityinen
tjsp., mutta älä lähetä samaa viestiä meilitse ja ryhmään.



Reply With Quote
  #6  
Old   
Andrew Thompson
 
Posts: n/a

Default Re: Widths and padding / margin.. - 11-02-2003 , 10:05 AM



"Kris" <kristiaan (AT) xs4all (DOT) netherlands> wrote

Quote:
In article <CC8pb.175895$bo1.105157 (AT) news-server (DOT) bigpond.net.au>,
"Andrew Thompson" <andrew64 (AT) bigNOSPAMpond (DOT) com> wrote:

I am developing a Periodic Table of the Elements
.....
It contains valid HTML and CSS
(checked 'moments' ago).

You may want to check again:
http://validator.w3.org/check?uri=ht...org%2Ftest%2Fc
hem%2Fptoe.html
Dang, that was quick! I blame the Gremlins..

Next try. New versions uploaded (both html and css)

Quote:
The 'width' value of table cells seems to have
no effect, can they be set? If so, how?

Set the width for a cell, using CSS and don't set any width for the
TABLE element, since it's resulting width will be the sum of the width
of the cells.
TABLE width now gone, ..hmmm seems no different.
(I have applied a width of 500px for the 'el' class)

Quote:
How can I collapse the gap between cells
containing chemical elements?

table ... cellspacing="0"
Tah.

I do not quite understand why setting
- margin: 0; - in the CSS had no effect tho,
....ehhh, shrugs.

With the space gone from between cells
and a few slight tweaks to the borders, I am
now quite happy with it.

I have even got used to the slightly 'stretchy / squeezy' *
feel of it that allows it to go quite small (it might
even render on a 640x480 monitor w/out scrollbars
if the browser font size is set to 'smallest').

* Ironically, that was an aspect of the original Applet
on which I based it, that I wanted to avoid in the
html/css version!

See the applet (if you have the Java plug-in) ..here
http://physci.org/applet/PToEApplet.htm

Thanks Kris

--
Andrew Thompson
http://www.AThompson.info/
http://www.PhySci.org/
http://www.1point1C.org/




Reply With Quote
  #7  
Old   
Andrew Thompson
 
Posts: n/a

Default Re: Widths and padding / margin.. - 11-02-2003 , 10:30 AM



Thanks Lauri for your comments, Cristoph covered
most of it so I'll reply to this..

"Christoph Paeper" <crissov2003Q4 (AT) gmx (DOT) net> wrote

Quote:
*Andrew Thompson* <andrew64 (AT) bigNOSPAMpond (DOT) com>:

I am developing a Periodic Table of the Elements
as<DIV>s ..(chuckle - just kidding!) a <TABLE

Hey, I once wanted to do the same to test all the features that HTML4
tables
provide, but quickly lost interest.
?? Just this one, I promise!

Quote:
The 'width' value of table cells seems to have no effect, can they be
set?

Yes.

| Applies to: all elements but non-replaced inline elements, table rows,
and row groups

OTOH 'margin' doesn't apply to table-cells and the other internal table
elements.

If so, how?

With the 'width' property either on the cells ('td' or 'th') or the column
('col' or 'colgroup'). You'll probably not be able to see it with the
automatic table algorithm used by default. Try "table-layout: fixed.
...hmm. I would have to investigate that further before I
clearly understood what you are saying, but the table
is good now.

Quote:
How can I collapse the gap between cells containing chemical elements?

border-collapse: collapse;
Thank you. I thought there _must_ be a way to do it
in CSS..

Quote:
If you use the value 'separate', you can specify the distance with the
'border-spacing' property. IIRC IE doesn't support the latter.

P.S.: Haven't elements 113 and 114 also been created already?
Probably.. you'd think they'd be running out of "U's"!

Quote:
"Periodic Table of the Elements" should be in 'caption', "(c) Andrew
Thompson, 2003" in 'tfoot'
Do you mean to label that cell of the table tfoot, or move
it to the bottom?

Quote:
and &copy; exists.
yes, sloppy of me..

Quote:
It's doubtful that you own
any^Wmuch intellectual property on the data on that page, though.
'fixed' ;-)
_________________________________________
With the removal of the '..stupid as set all cells 25 em wide'
bit (..hey, I was _playing_, ok?) the table has settled in nicely.

It reduces down nice and small for small font size.

Thank you all!

--
Andrew Thompson
http://www.AThompson.info/
http://www.PhySci.org/
http://www.1point1C.org/




Reply With Quote
  #8  
Old   
Andrew Thompson
 
Posts: n/a

Default Re: Widths and padding / margin.. - 11-02-2003 , 11:55 AM



"Brian" <usenet1 (AT) julietremblay (DOT) com.invalid-remove-this-part> wrote in
message news:V2bpb.66875$9E1.280354 (AT) attbi_s52 (DOT) ..
....
Quote:
*Andrew Thompson* <andrew64 (AT) bigNOSPAMpond (DOT) com>:

I am developing a Periodic Table of the Elements as<DIV>s
..(chuckle - just kidding!) a <TABLE

OT
Perhaps you should use the <abbr> element for the symbols. That'd make
it quite a bit more functional, no?
Tried it for lithium. That is cool.
Looks great in Mozilla 1.3a - does not
seem to work in IE6 though.

Since I will eventually be adding links to each of the
element symbols*, I might simply (and improperly,
as I understand from previous posts) use..
<a href="lithium.jsp" TITLE="Lithium">Li</a>

If it does not work for a particular browser, it
should not be a great loss, since the visitor would
just need click the link for further details in any case.

* I will be ultimately be using JSP and servlets
to extract data from a Java .jar and render it
using 'html' and css. But I find it is best to get
the html and css straight before worrying about
other factors.

Quote:
How can I collapse the gap between cells containing chemical
elements?

border-collapse: collapse;

Thank you. I thought there _must_ be a way to do it in CSS..

Note that IE 5/Mac does not support this. You'll have to resort
to cellspacing for that browser.
Uugghh, alright. I need to do some serious _backwards_
compatibility testing, but I have not decided how far it
is worth pushing it, especially when the information is
technical and readable.

I might have to 'inline' the colors though..

--
Andrew Thompson
http://www.AThompson.info/
http://www.PhySci.org/
http://www.1point1C.org/




Reply With Quote
  #9  
Old   
Andrew Thompson
 
Posts: n/a

Default Re: Widths and padding / margin.. - 11-02-2003 , 12:16 PM



"Andrew Thompson" <andrew64 (AT) bigNOSPAMpond (DOT) com> wrote

Quote:
"Brian" <usenet1 (AT) julietremblay (DOT) com.invalid-remove-this-part> wrote in
message news:V2bpb.66875$9E1.280354 (AT) attbi_s52 (DOT) ..
Chemical symbol Li (lithium)...

Quote:
Perhaps you should use the <abbr> element for the symbols. That'd make
it quite a bit more functional, no?

Tried it for lithium. That is cool.
Looks great in Mozilla 1.3a - does not
seem to work in IE6 though.

Since I will eventually be adding links to each of the
element symbols*, I might simply (and improperly,
as I understand from previous posts) use..
a href="lithium.jsp" TITLE="Lithium">Li</a

If it does not work for a particular browser, it
should not be a great loss, since the visitor would
just need click the link for further details in any case.
Scrap that - reconsidered. Since I am prepared
to lose the pop-up text for 'lesser abled' browsers,
I may as well use the <attr> as it seems intended,
and wrap that in an unTitled <a>..
For demonstraion purposes I now have a version
up that uses
<abbr> for lithium
<a title> for beryllium
<a><abbr title> for phosphorus.

I'll go with the format for phosphorus.

--
Andrew Thompson
http://www.AThompson.info/
http://www.PhySci.org/
http://www.1point1C.org/




Reply With Quote
  #10  
Old   
Kris
 
Posts: n/a

Default Re: Widths and padding / margin.. - 11-02-2003 , 12:22 PM



In article <vSbpb.175944$bo1.138718 (AT) news-server (DOT) bigpond.net.au>,
"Andrew Thompson" <andrew64 (AT) bigNOSPAMpond (DOT) com> wrote:

Quote:
If it does not work for a particular browser, it
should not be a great loss, since the visitor would
just need click the link for further details in any case.

Scrap that - reconsidered. Since I am prepared
to lose the pop-up text for 'lesser abled' browsers,
I may as well use the <attr> as it seems intended,
and wrap that in an unTitled <a>..
For demonstraion purposes I now have a version
up that uses
abbr> for lithium
a title> for beryllium
a><abbr title> for phosphorus.

I'll go with the format for phosphorus.
<http://www.xs4all.nl/~apple77/abbr_support/>
Check it in IE/Win. I don't deserve credit for it.

--
Kris
kristiaan (AT) xs4all (DOT) netherlands (nl)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.