center floating text box on page

J

Joel

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
 
R

Ronx

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 :
 
H

Hot-text

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top