The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> CSS controlling text directly inside <td>
Brian Chandler
post Dec 8 2011, 10:01 AM
Post #1


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



I have text directly inside a <td>, as in the sample page here:

http://imaginatorium.org/private/cartons.html

Can anyone tell me how to control the margin (padding etc) around this text?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Dec 8 2011, 11:09 AM
Post #2


.
********

Group: WDG Moderators
Posts: 9,653
Joined: 10-August 06
Member No.: 7



Is this for screen or print media (considering you use mm units)?

Table cells have no CSS margins, but the TABLE element can have http://www.w3.org/TR/CSS21/tables.html#pro...-border-spacing



User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Dec 8 2011, 11:22 AM
Post #3


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



Thanks Christian. It's for printing, and I wanted to squeeze down the vertical margin/padding to get everything on one sheet.

The space between the top and bottom of the text and the adjacent cell border is more than the "padding" value on <td>. So I guess the text directly within the <td> gets some "default" padding/margin from somewhere, but there doesn't seem to be a way of accessing it.

I have border-collapse: collapse; so I don't understand how "border-spacing" would apply?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Darin McGrew
post Dec 8 2011, 11:33 AM
Post #4


WDG Member
********

Group: Root Admin
Posts: 8,365
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



It could also be an effect of the line height, assuming it's greater than 1.0.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Frederiek
post Dec 8 2011, 12:19 PM
Post #5


Programming Fanatic
********

Group: Members
Posts: 5,146
Joined: 23-August 06
From: Europe
Member No.: 9



It seems that 1 mm equals 3 pixels and 2 mm equals 7 pixels for the padding you set on TD, according to the calculated style in Safari.

Otherwise, the page fits on a A4 paper, slightly a little too much to the right (only tested in Preview).
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th April 2024 - 09:56 AM