Hard Light Productions Forums
Off-Topic Discussion => General Discussion => Topic started by: Sandwich on July 16, 2002, 07:38:47 pm
-
I'm wondering if there's any way to set a width - say, in pixels - beyond which a page element (paragraph of text, DIV, whatever) will not expand. But at the same time if the browser window is too narrow to display that paragraph at a full width, it will word wrap the text instead of displaying a horizontal scrollbar at the bottom of the window.
For example: I want to have my paragraph text word-wrap at 700 pixels, or less. I.E. If my browser window is 550 pixels wide, I want the text to word-wrap at the border of the window, not forcibly extend to 700 pixels. But if my browser is 1024 pixels wide, I want the text to wrap at its set maximum of 700 pixels width.
Any ideas?
-
I think there's a margin tag or something that sets the max edge of the text but I can't remember the code/tags for it.
-
Originally posted by an0n
I think there's a margin tag or something that sets the max edge of the text but I can't remember the code/tags for it.
Nope - margin is a style sheet property which defines how much white space to leave on a given side.
-
Make everything nice and normal with the text word-wrapping all the time, then place a big transparent gif in the background that's the width you want the page to start scrolling at. Then when the window edge hits the image it'll start scrolling.
Or you could use Javascript to get the tags to change, like:
If screenwidth<200, < div width=199 >
else
< div width=90% >
-
Originally posted by an0n
Make everything nice and normal with the text word-wrapping all the time, then place a big transparent gif in the background that's the width you want the page to start scrolling at. Then when the window edge hits the image it'll start scrolling.
Or you could use Javascript to get the tags to change, like:
If screenwidth<200, < div width=199 >
else
< div width=90% >
Nice idea, but I think you misunderstood. At no point do I want the window to scroll horizontally. I want the text to take up as much room as it has available, even if it'ss only 25 pixels of width, up until a certain width.
The reason for this is that when lines of text are too long, they can get to be hard to read. So I want to limit the width that the text will expand to.
-
Yeah, well it's the same just using screenwidth>200.
-
i don't get what you're trying to say... if it's what you want is for the writing/movie/etc. to be against the side of the screen without a half-inch or so 'border'... (this is quite common when exporting Flash SWF files)
in the body of the html add this to the body tag:
MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BOTTOMMARGIN="0"
--------------
(If this involves flash):
In the publish settings use 100% for both width and height instead of WIDTH=700 HEIGHT=520
and
--------------
if you say you want it to scroll instead of word wrap i'm not sure cause i can't see exactly, but try putting "scrolling=yes" in the 'body' tag...
-
Haha, they forgot to disable the td tags.
Anyway. Doesn't using div's do what you want?
-
div tags should do it, if they don't, then try my method... i'm not exactly sure what it is you want though
-
No, none of those works - I've tried. A script could work; essentially what I'm looking at is something like this (this will probably come out as some sort of weird combo of PHP and Javascript... :p):
if (window.width <= 500px) {
text.width = 100%;
} elseif (window.width > 500px) {
text.width = 500px;
}
So when the text is in a smaller window, it will flow out to the border, and when the window is wider than a certain size, the text will only expand to that size.