css - centering text in a browser window w/ extra wide page

P

ppcguy

i've got a page that's very wide - e.g. 2000px.

i'd like to display some text that's centered on the browser window -
not the entire logical page.

so if the browser client window is 800 px wide, i'd like to center
the text across the first 800.

how can this be done - assuming css adapts to changing widths
 
L

Leonard Blaisdell

ppcguy said:
i've got a page that's very wide - e.g. 2000px.

URL? If your page is only viewed at 2000px or wider without showing a
horizontal scrollbar, you are certainly making it inconvienient to most
people on the web today.
i'd like to display some text that's centered on the browser window -
not the entire logical page.

so if the browser client window is 800 px wide, i'd like to center
the text across the first 800.

And then have them scroll for the next 1200px horizontally to see the
rest?
how can this be done - assuming css adapts to changing widths

CSS is all about adapting to changing viewport widths.
<http://www.allmyfaqs.com/faq.pl?AnySizeDesign> may help you.
I have not addressed your original question since I have experience
centering text from little to big but not from big to little with a
2000px width 'required'. Perhaps I misunderstand what a logical page is.

leo
 
S

Spartanicus

ppcguy said:
i've got a page that's very wide - e.g. 2000px.

Something to fix.
i'd like to display some text that's centered on the browser window -
not the entire logical page.

so if the browser client window is 800 px wide, i'd like to center
the text across the first 800.

<p style="text-align:center">Text centered in browser viewport.</p>
 
P

ppcguy

perhaps i need to re-explain.

i've got a page that's wide...so a horizontal scroll
bar is there.

i've got a message that i'd like to display centered
on the browser window.

because if i do <P align=center>msg</P> because
the page is wide, sometimes the message is not seen.

so i'd like to display the msg so that it's centered
on the initial browser window

+--------------+------------------------------+
| | |
| Mesge | |
| | |
| This is the full logical web page. |
+-------------+--------------------------------+
^
this is the visible browser window
 
D

David Dorward

ppcguy said:
perhaps i need to re-explain.

It would be nice if you could use capital letters in the appropriate places,
they make it much easier to read requests for help.
i've got a page that's wide...so a horizontal scroll
bar is there.

i've got a message that i'd like to display centered
on the browser window.

because if i do <P align=center>msg</P> because
the page is wide, sometimes the message is not seen.

You haven't provided a URL, so its rather difficult to say what the problem
is. At a guess, I would imagine that you are using tables for layout, and
the table containing the text you wish to centre is very wide (and thus the
problem is the width of the table, not the page).

When I created a test case containing one very wide table, and a centred
paragraph outside it, the paragraph was centred in the window, now in the
width of the document once the table had been accounted for. Don't use
tables for layout.

http://www.allmyfaqs.com/faq.pl?Tableless_layouts
 
N

Neredbojias

With neither quill nor qualm, ppcguy quothed:
i've got a page that's very wide - e.g. 2000px.

i'd like to display some text that's centered on the browser window -
not the entire logical page.

so if the browser client window is 800 px wide, i'd like to center
the text across the first 800.

how can this be done - assuming css adapts to changing widths

You can use "position:fixed" in compliant browsers. Won't work in IE (-
although there are workarounds I haven't explored - javascript if
nothing else.)

Here's an example for Mozilla, etc.

http://www.neredbojias.com/beta/_lr/lra12.html
 
T

Toby Inkster

ppcguy said:
+--------------+------------------------------+
| | |
| Mesge | |
| | |
| This is the full logical web page. |
+-------------+--------------------------------+

Egads! Use a fixed width font when you're going to do ASCII art!
 

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

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top