Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsDiscussion Forum → HTML units?
HTML units?
2007-11-23, 10:29 AM #1
Ive looked around the net and not found what Im looking for so thought Id ask here.

When you define a table in html you can specify the height and width of a table data frame. what is this unit of measurement?

ie.
<table>
<tr>
<td width="20">
</td>
</tr>
</table>

this is 20 what? its not pixles. Its not characters. what is it!!!
The tips at the end of shoelaces are called "aglets". Their true purpose is sinister.
2007-11-23, 10:40 AM #2
It's a proprietary width, and it doesn't matter. Use CSS to style the width in pixels or em, or even better, just don't use tables for formatting?
ᵗʰᵉᵇˢᵍ๒ᵍᵐᵃᶥᶫ∙ᶜᵒᵐ
ᴸᶥᵛᵉ ᴼᵑ ᴬᵈᵃᵐ
2007-11-23, 10:41 AM #3
I believe it's percent, but really you should use CSS, then you can specify the units yourself
e.g.
<td style="width: 20px;"></td>


With CSS there are many units available: %, px, em, ex (along with absolute units in: inches, cm: centimeters.. but they are rather annoying to use unless you really need to get something positioned when it's printed.)
TheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWho
SaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTh
eJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSa
ysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJ
k
WhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSays
N
iTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkW
2007-11-23, 10:43 AM #4
It's pixels. You can also define it as <td width="20px">.
TAKES HINTS JUST FINE, STILL DOESN'T CARE
2007-11-23, 2:58 PM #5
Or width="20%" if you'd rather. It'll use 20 percent of the table's width, so if the table is constrained to 100 pixels, that cell will be 20% of 100 or... 20 pixels.

Who said he was using tables for layout...?
2007-11-23, 4:10 PM #6
Usually, setting the width and height of a table means you're using it for layout. Padding is more compliant for data, as it defines a table-wide value.
ᵗʰᵉᵇˢᵍ๒ᵍᵐᵃᶥᶫ∙ᶜᵒᵐ
ᴸᶥᵛᵉ ᴼᵑ ᴬᵈᵃᵐ
2007-11-23, 5:00 PM #7
What? I always set column widths when displaying tabular data. Either percentages, ems if I know the number of characters i'm expecting (e.g. for formatted dates) or pixels.

Although mostly (always?) it's better to set the column widths in the <th> cells.
TheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWho
SaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTh
eJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSa
ysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJ
k
WhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSays
N
iTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkW
2007-11-23, 6:12 PM #8
What Im making is a user defined HTML page using an interface where you set table and element values. Trying to make it simple as possible and want to label the interface with the units of measurement for sizes.
The tips at the end of shoelaces are called "aglets". Their true purpose is sinister.
2007-11-23, 6:33 PM #9
Originally posted by JediKirby:
Usually, setting the width and height of a table means you're using it for layout. Padding is more compliant for data, as it defines a table-wide value.


Um no.
2007-11-23, 11:26 PM #10
If you're doing proper CSS coding it doesn't matter either way, there's no reason to use the width property in the HTML. It should be in the CSS.
2007-11-23, 11:30 PM #11
Isn't padding a cell property? Specifically, it defines how much space "pads" the text/media from the border of the cell?
2007-11-24, 12:22 AM #12
Originally posted by Jedi Legend:
Isn't padding a cell property? Specifically, it defines how much space "pads" the text/media from the border of the cell?


Depends if you're refering to CSS or HTML. For HTML, padding is used for cells in a table but in CSS, padding can be used for almost anything that will accept it.
The cake is a lie... THE CAKE IS A LIE!!!!!
2007-11-24, 12:59 AM #13
The one thing that annoys me about CSS is that there is no reliable way to center block items. Text-align: center only works on text, so that's useless for divs.

<div align="center"> works, but is deprecated for Strict doctypes, IIRC, so I try not to use it. (I have no idea why the W3C did that)

I know about margin-left: auto and margin-right: auto; but I've had instances where that didn't work. Is there a better way, or even one guaranteed to work and still be valid CSS/HTML?
2007-11-24, 3:09 AM #14
In general, the situations where centering using auto margins doesn't work are situations where you shouldn't be centering anyways.

But you should really post an example of your problem.
Detty. Professional Expert.
Flickr Twitter
2007-11-24, 6:42 AM #15
This is a little untidy, but if you know the width of the item you're centring then you can use negative margins to centre it.

e.g.

Code:
<div style="width: 100%">
<div style="left: 50%; width: 600px; margin-left: -300px;">This is centered!</div>
</div>


The idea is that the div is positioned 50% across the page, then moved back half of it's own width.
TheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWho
SaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTh
eJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSa
ysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJ
k
WhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSays
N
iTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkW

↑ Up to the top!