[thelist] Re: auto-sized boxes, and a CSS rant
Jonathan_A_McPherson at rl.gov
Jonathan_A_McPherson at rl.gov
Tue Jun 25 15:10:01 CDT 2002
John,
That is indeed a possible solution.
The problem is that I want the width of the box to be determined by the text
in the box, not by a hard-coded number.
I can indeed get a "scaleable" width with ems, but using ems means I must
manually determine the length of the text in ems, and then use that amount
as the width.
width = x ems, looks good
+------------page-----------+
| +-------------+ |
| |do this | |
| |do that | |
| |do otherstuff| |
| +-------------+ |
+---------------------------+
width = x ems, text has changed
+------------page-----------+
| +-------------+ |
| |do this | |
| |do that | |
| |do whatever | |
| +-------------+ |
+---------------------------+
The text no longer appears to be properly centered, and the box is no longer
fitted properly to the text.
Every time I change the text, I must recalculate and insert the width in
ems.
This is annoying to do manually, and downright frustrating when the text is
coming out of a database (could be arbitrarily long).
--
Jonathan McPherson, LMIT/SD&I
Software Engineer & Web Systems Analyst
email / jonathan_a_mcpherson at rl dot gov
-----Original Message-----
From: John Snavely [mailto:snavely at amnh.org]
Sent: Tuesday, June 25, 2002 11:21 AM
To: thelist at lists.evolt.org
Subject: [thelist] Re: auto-sized boxes, and a CSS rant
Basically, you don't want to set a width on a box that will have
varying input text lengths. But if you don't specify a width the box
takes up as much width as it can in a browser window. So your text is
left aligned to a centered box that is 100% wide.
The solution:
Specify a width for your box, but in em units. That way when a user
increases their font size, the size of the box will also increase
along with the font.
--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !
More information about the thelist
mailing list