pixels vs bytes

liunx

Guest
when writing a page on the fly how do i size the td element and consequently a textbox in that element to hold and display text obtained from a database, eg someone's name, address etc.<!--content-->if you don't do a thing but put the basic elements in place, they will size themselves, with the exception of the textbox. use your own discretion with that... and btw, textboxes are sized by default in terms of characters, so keep that in mind. outside of that, specify a width for your table data cell by using width=250 (for example, 250 pixels).<br />
<br />
now, if you're talking about sizing it dynamically, according to how much data is in the particular field of the DB that you are querying, then you'd have to use a server-side scripting language to count the characters in the field and write it to a variable. i'm not too good with that kind of stuff, so tell us what language you will be using, if that's the case, and someone will be along sooner or later to give you some better pointers on that than i can.<br />
<br />
good luck!<!--content-->i'm using vb with iis5.0 instead of asp. they work exactly the same.<br />
when i use the 'Len' function to get the # of characters, say 20, then if i use that number (20) to size the textbox, the box will be 20 px, cm, inches, etc, not characters.<br />
i guess i need to somehow convert each character to something usable in css html.<br />
thanks for your reply.<!--content-->or just use a formula to convert 1 character into x pixels?<!--content-->>> or just use a formula to convert 1 character into x pixels <<<br />
<br />
I believe that that will only work for a non-proportional font, unless you actually count "l" as 2 or 3 pixels and "w" as 7 or 8 pixels or so.<!--content-->
 
Back
Top