From: Joel on
is there a way to center a floating text box on a page so it stays centered
no matter what the browser resolution is? Is seems that I can only set
absolute position and and want the text box to be centered on the page no
matter what resolution or window size.

tia,

joel
From: Ronx on
To centre an HTML element you need three things:

1) A complete and valid doctype

2) Left and right margins set to auto

3) A fixed width for the element

An example is at
http://www.rxs-enterprises.org/tests/pages/center_para.html

Note that if you use Absolute Positioning for a container that contains text, the page WILL break when a user resizes the text.
If you knew all about absolute positioning, you would avoid it.

What do you mean by Text-Box? If this is the text box produced from the Drawing tool bar, then avoid that as well. It uses VML graphics in IE, and a picture of the contents in other browsers.
See http://wwww.rxs-enterprises.org/fp/articles/2007/10/02/01/VML-graphics.aspx for more details.
--
Ron Symonds
Microsoft MVP (Expression Web)
http://www.rxs-enterprises.org/fp/wf-menu.aspx




Joel submitted this idea :
> is there a way to center a floating text box on
> a page so it stays centered no matter what the
> browser resolution is? Is seems that I can
> only set absolute position and and want the
> text box to be centered on the page no matter
> what resolution or window size.

> tia,

> joel

--
Ron Symonds
Microsoft MVP (Expression Web)
http://www.rxs-enterprises.org/fp/wf-menu.aspx


From: Hot-text on
Yes you can! But Joel need to see the Code you working with to help you!

// a JavaScript alert text box

<SCRIPT language=JavaScript type=text/javascript>
<!--
//hide from old browsers
alert('there a way to \n ©center© \n a floating text box \n on a page \n
so it stays centered')
// -->
</SCRIPT>

//A floating text box marquee

<script language="JavaScript">
<!-- Begin
mesg = "The JavaScript Source, another marvelous use of bandwidth!";
isNS = (navigator.appName == "Netscape");
isIE = (navigator.appName == "Microsoft Internet Explorer");
text = ("<i><font size=2>"+mesg+"</font></i>");
if (isNS) {
document.write("<blink>" + text + "</blink>");}
else if (isIE) {
document.write("<marquee behavior=alternate direction=right>" + text +
"</marquee>");}
// End -->
</script>
<noscript>
<i><font size=2>The JavaScript Source, another marvelous use of
bandwidth!</font></i>
</noscript>





"Joel" <Joel(a)discussions.microsoft.com> wrote in message
news:9D263A88-8293-44A6-BF1E-497BE401C87A(a)microsoft.com...
> is there a way to center a floating text box on a page so it stays
> centered
> no matter what the browser resolution is? Is seems that I can only set
> absolute position and and want the text box to be centered on the page no
> matter what resolution or window size.
>
> tia,
>
> joel