Thanks, Stephen, and as my teachers always told me, there are no dumb
questions. Especially when you're helping out someone stuck on a problem.
;-)
As far as item #1, yes, that div was already styled with a 3px border (and
an underlying offset light-grey "shadow" div).
On item #2, in the script the var "theWidth" is first set to the untrimmed
width (the AS/400, like many character-based apps, uses field value space
padding for screen positioning) of the passed-in string value. The string is
then trimmed of leading/trailing spaces, and then the .screenTitle div width
is set to the value of "theWidth," making it actually wider than the trimmed
string, which is positioned text-align:center in the CSS. This alone should
prevent wrapping, since it would seem that the math would make the div
*always* be wider than the trimmed string. (??)
Item #4 is a possibility I haven't tried yet, although to be honest I don't
see how a positioned div which is outside the page flow would have its
internal characteristics affected by anything else on the page. It's a
thought, though, and if nothing else works I'll mod our initPage() and
setCompanyScreenCenter() functions to see what happens.
Item #3, now, I hadn't even thought of, and that looks like it might have a
good deal of promise. It'll have to wait until tomorrow, it seems, since the
WebOptions server is having conniptions right now and won't let us end a job
that's got it wrapped around itself. While the boss deals with that I'm
doing some local-system housekeeping. I should be able to give it a shot
tomorrow to see if #3 or #4 can lick this beast.
Thanks a lot for the suggestions; I'll let you know how the outcome turns
out.
Cheers,
Scott
----- Original Message -----
From: "Stephen Caudill" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 23, 2004 4:02 PM
Subject: [wdvltalk] Re: DIV doesn't auto-size
At the risk of asking dumb questions... did you:
- add a border to the container div to check that it's actually
filling the window?
- explicitly set .screenTitle{width:100%;}
- try setting the children of .screenTitle to not wrap (.screenTitle
*{white-space:nowrap;})
- maybe add a deferred script to the page, so that .screenTitle or
it's descendant has it's width set last of all...
just a few ideas.
hth,
Stephen
On Mon, 23 Aug 2004 14:02:07 -0400, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> In our current app (a Web front end to an AS/400 "green screen" app) we
have
> a field representing the screen title for each screen, called, oddly
enough,
> screenTitle. It is contained in an absolutely positioned DIV with no width
> attribute. Due to the nature of the AS/400 app providing the data, some
> (many) items must be styled post-rendering using javascript. The CSS and
js
> code I've been using has worked fine up until this one screen, which has a
> longer than usual title. On this screen the field is wrapping, which it
> shouldn't do, as far as I know. Here's the CSS for the DIV:
>
> ..screenTitle {
> position:absolute;
> margin-left: auto;
> margin-right: auto;
> font-family:Verdana, Arial, Helvetica, sans-serif;
> font-weight:bold;
> font-size:12px;
> color:#000000;
> text-align: center;
> z-index: 10;
> }
>
> Here's the HTML for the element:
>
> <div id="screenTitle" class="screenTitle"><!-- -->Display Customer Item
> Reference by UPC Code</div>
>
> And here's the javascript used (called in our initPage function) to center
> the DIV on the screen:
>
> function setCompanyScreenCenter()
> {
> var theNode = getLikeElements("div", "id", "screenTitle");
> // alert('This node\'s ID is ' + theNode[0].id);
> if (theNode[0]) {
> var theWidth = theNode[0].clientWidth;
> if (theNode[0].firstChild.nextSibling) {
> if (theNode[0].firstChild.nextSibling.nodeType == 3) { //text
> node
> var workString =
> theNode[0].firstChild.nextSibling.nodeValue;
> workString = trim(workString);
> theNode[0].firstChild.nextSibling.nodeValue = workString;
> theNode[0].style.left = 730/2 - (theWidth/2) + "px";
> //container DIV width is 730px
> theNode[0].style.width = theWidth;
> } //if (theNode[0].first...
> } //if (theNode[0].first...
> } //if (theNode[0])
> } //function
>
> Everything works fine on every other page. My experience has been that a
DIV
> with no width or overflow attribute will automatically expand horizontally
> to accommodate its contents, up to the width of its parent container. I am
> nonplussed as to why this one doesn't seem to be "following the script,"
so
> to speak. Any ideas?
>
> Cheers,
> Scott
>
> ____ . The WDVL Discussion List from WDVL.COM . ____
> To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
> Send Your Posts To: [EMAIL PROTECTED]
> To set a personal password send an email to [EMAIL PROTECTED] with the
words: "set WDVLTALK pw=yourpassword" in the body of the email.
> To change subscription settings to the wdvltalk digest version:
> http://wdvl.internet.com/WDVL/Forum/#sub
>
> ________________ http://www.wdvl.com _______________________
>
> You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
%%email.unsub%%
>
> To unsubscribe via postal mail, please contact us at:
> Jupitermedia Corp.
> Attn: Discussion List Management
> 475 Park Avenue South
> New York, NY 10016
>
> Please include the email address which you have been contacted with.
>
>
____ . The WDVL Discussion List from WDVL.COM . ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with the
words: "set WDVLTALK pw=yourpassword" in the body of the email.
To change subscription settings to the wdvltalk digest version:
http://wdvl.internet.com/WDVL/Forum/#sub
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to %%email.unsub%%
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016
Please include the email address which you have been contacted with.
____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED]
Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with the words: "set
WDVLTALK pw=yourpassword" in the body of the email.
To change subscription settings to the wdvltalk digest version:
http://wdvl.internet.com/WDVL/Forum/#sub
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016
Please include the email address which you have been contacted with.