Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Table cells

Reply
Thread Tools

Table cells

 
 
Brian Robertson
Guest
Posts: n/a
 
      06-26-2007
I am doing something wrong on a style sheet. I want some space before
the text in the cells of a table, so I used this:

td {
height:19px;
background-color: rgb(248,239,182);
margin-left: 3;
}

When viewed in my editor the spaces are there as desired, but once
viewed with a browser they are gone.

Help!

Brian.
 
Reply With Quote
 
 
 
 
Jonathan N. Little
Guest
Posts: n/a
 
      06-26-2007
Brian Robertson wrote:
> I am doing something wrong on a style sheet. I want some space before
> the text in the cells of a table, so I used this:
>
> td {
> height:19px;
> background-color: rgb(248,239,182);
> margin-left: 3;
> }
>
> When viewed in my editor the spaces are there as desired, but once
> viewed with a browser they are gone.
>


Margin is outside the element padding is inside the element, therefore
if your want to add space to the text *inside* the TD then the property
for the TD should be padding. Also your must use *units* for almost all
length properties "margin-left: 3;" is invalid, best to use units
proportional with respect to the font

td { height: 1.5em; padding-left: .25em; }

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
 
 
 
Bergamot
Guest
Posts: n/a
 
      06-26-2007
Brian Robertson wrote:
>
> td {
> margin-left: 3;
> }


3 what? Hobnobs? Non-zero length values require a unit: em, px, %, etc.

BTW, margins on a table cell may give odd results in some browsers. Use
padding instead.

--
Berg
 
Reply With Quote
 
Brian Robertson
Guest
Posts: n/a
 
      06-26-2007
Bergamot wrote:
> Brian Robertson wrote:
>> td {
>> margin-left: 3;
>> }

>
> 3 what? Hobnobs? Non-zero length values require a unit: em, px, %, etc.
>
> BTW, margins on a table cell may give odd results in some browsers. Use
> padding instead.
>


Comes from using Frontpage!

Brian.
 
Reply With Quote
 
Brian Robertson
Guest
Posts: n/a
 
      06-26-2007
Jonathan N. Little wrote:
> Brian Robertson wrote:
>> I am doing something wrong on a style sheet. I want some space before
>> the text in the cells of a table, so I used this:
>>
>> td {
>> height:19px;
>> background-color: rgb(248,239,182);
>> margin-left: 3;
>> }
>>
>> When viewed in my editor the spaces are there as desired, but once
>> viewed with a browser they are gone.
>>

>
> Margin is outside the element padding is inside the element, therefore
> if your want to add space to the text *inside* the TD then the property
> for the TD should be padding. Also your must use *units* for almost all
> length properties "margin-left: 3;" is invalid, best to use units
> proportional with respect to the font
>
> td { height: 1.5em; padding-left: .25em; }
>


Thanks!
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      06-26-2007
In article <(E-Mail Removed)>,
Bergamot <(E-Mail Removed)> wrote:

> Non-zero length values require a unit: em, px, %, etc.


This is right.

However, there is a small implication here that it is quite ok
not to use them for zero lengths. Technically this is correct.
However, there is an issue of some gravity here.

Jean-Paul Sartre was sitting at a French cafe, revising his draft
of Being and Nothingness. He said to the waitress, "I'd like a
cup of coffee, please, with no cream." The waitress replied, "I'm
sorry, monsieur, but we're out of cream. How about with no milk?"

Now surely, if a cup of coffee without milk is different to a cup
of coffee without cream, then a length without any pixels is
different to a length without any em width. So those with a
particular interest in great clarity in their css might be wise
to use units for zero lengths too. It will do no harm and it will
communicate more precisely with those who read css sheets.

--
dorayme
 
Reply With Quote
 
Neredbojias
Guest
Posts: n/a
 
      06-27-2007
On Tue, 26 Jun 2007 23:01:16 GMT dorayme scribed:

> In article <(E-Mail Removed)>,
> Bergamot <(E-Mail Removed)> wrote:
>
>> Non-zero length values require a unit: em, px, %, etc.

>
> This is right.
>
> However, there is a small implication here that it is quite ok
> not to use them for zero lengths. Technically this is correct.
> However, there is an issue of some gravity here.
>
> Jean-Paul Sartre was sitting at a French cafe, revising his draft
> of Being and Nothingness. He said to the waitress, "I'd like a
> cup of coffee, please, with no cream." The waitress replied, "I'm
> sorry, monsieur, but we're out of cream. How about with no milk?"
>
> Now surely, if a cup of coffee without milk is different to a cup
> of coffee without cream, then a length without any pixels is
> different to a length without any em width. So those with a
> particular interest in great clarity in their css might be wise
> to use units for zero lengths too. It will do no harm and it will
> communicate more precisely with those who read css sheets.


Actually, the question should be "Is nothing equal to 0?" and the answer
is "No."

Example:

Cookies left in the jar=0
Cookies left in the jar=

Are the above two lines meaningfully the same?

According to (most) scientists, the universe started from a singularity.
Hypothetically, this singularity was nothing (or 0 if your prefer) but
had the theoretical *potential* to be something. Furthermore, the name
"singularity" in this context definitely does not relate to "1" because,
as I have proven elsewhere, you cannot have just 1 exclusively in a
totality unless you consider a possible all-encompassing totality as "The
Totality", i.e. 1, and the only thing in existence forevermore.

Now the next question is "How can you have 'nothing with potential?'"
Isn't that very potential something in its own right? The answer is that
you cannot have "nothing with potential" because potential implies the
existence of time, which, of course, would be not nothing. Ergo, the
"potential theory" is nothing.

Unfortunately, this brings us back to the nothing vs. zero problem. If
zero has no potential, does it not equate to nothing? The only logical
solution is that 0 does, indeed, imply something in addition to itself
(as opposed to "nothing") but which can be defined exclusively by numbers
or other tangible contrivances irrational in scope.

In conclusion, all this goes to prove that religion is inconsummate,
God's existence is inconceivable, and putting units after 0 quantities in
css is an exercise in futility. However, dues to flaws beyond the
markupists' control, it realistically is sometimes not.

--
Neredbojias

Once I had a little bird
That made me rather hasty.
So now I have no little bird,
But it was very tasty.
 
Reply With Quote
 
Toby A Inkster
Guest
Posts: n/a
 
      06-27-2007
dorayme wrote:
> Bergamot <(E-Mail Removed)> wrote:
>
>> Non-zero length values require a unit: em, px, %, etc.

>
> This is right.
>
> However, there is a small implication here that it is quite ok
> not to use them for zero lengths. Technically this is correct.
> However, there is an issue of some gravity here.


<snip very interesting allegory about Sartre>

Also "line-height" doesn't require a length. When the length is missed
out, it behaves a bit like "em", but not quite.

For what it's worth, when I'm in early stages of CSS layout, I often set a
bunch of borders on elements to:

border: 0px solid magenta;

(and dotted/dashed lime/cyan/yellow/red/etc).

Then, with a single search-and-replace I can change 0px to 1.0px to see
borders around everything. Then search-and-replace back.

By leaving on the "px" my search-and-replace is able to differentiate
between these debugging borders, and other, more normal, occurrences of 0
in my style sheet.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 6 days, 15:46.]

The End of an Era
http://tobyinkster.co.uk/blog/2007/06/26/end-of-an-era/
 
Reply With Quote
 
Brian Robertson
Guest
Posts: n/a
 
      06-27-2007
Toby A Inkster wrote:
> dorayme wrote:
>> Bergamot <(E-Mail Removed)> wrote:
>>
>>> Non-zero length values require a unit: em, px, %, etc.

>> This is right.
>>
>> However, there is a small implication here that it is quite ok
>> not to use them for zero lengths. Technically this is correct.
>> However, there is an issue of some gravity here.

>
> <snip very interesting allegory about Sartre>
>
> Also "line-height" doesn't require a length. When the length is missed
> out, it behaves a bit like "em", but not quite.
>
> For what it's worth, when I'm in early stages of CSS layout, I often set a
> bunch of borders on elements to:
>
> border: 0px solid magenta;
>
> (and dotted/dashed lime/cyan/yellow/red/etc).
>
> Then, with a single search-and-replace I can change 0px to 1.0px to see
> borders around everything. Then search-and-replace back.
>
> By leaving on the "px" my search-and-replace is able to differentiate
> between these debugging borders, and other, more normal, occurrences of 0
> in my style sheet.
>


Let me explain where my mistake came from. I am reading a book about CSS
and slowly learning new things, but these things take time. Meanwhile, I
wanted to sort the padding problem out. Previously I had highlighted the
text and put the padding in through Frontpage settings. The code was an
inline style and it said margin-left: 3. There was no unit shown. From
this I simply tried to guess the proper rule and then turned to you lot
for help. It worked but was clumsy, which is why I wanted it out.

Brian.
 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      06-27-2007
In article <(E-Mail Removed)5n.co.uk>,
Toby A Inkster <(E-Mail Removed)> wrote:

> For what it's worth, when I'm in early stages of CSS layout, I often set a
> bunch of borders on elements to:
>
> border: 0px solid magenta;


Me too, one's own private "FF developer type outline elements"
facility...

--
dorayme
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert yyyymmdd text cells into date cells =?Utf-8?B?ZF9jYW1wZWxvQGhvdG1haWwuY29t?= Microsoft Certification 2 11-22-2006 04:52 PM
Table where I want to draw a border around the whole table but not between the cells. UJ ASP .Net 8 06-12-2006 06:20 PM
Writing to Cells in the Detailsview Insertmode makes cells uneditable. SixStringSlaya@gmail.com ASP .Net 0 02-28-2006 10:23 PM
Cells[].Text or Cells[].Controls[0] Joel Finkel ASP .Net Datagrid Control 0 09-01-2003 04:42 PM
Re: width of table cells, table inside of form bbxrider HTML 0 07-14-2003 08:02 PM



Advertisments