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

Discussion in 'HTML' started by ppcguy, Aug 25, 2005.

  1. ppcguy

    ppcguy Guest

    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
     
    ppcguy, Aug 25, 2005
    #1
    1. Advertising

  2. In article <MyrPe.3658$>,
    "ppcguy" <> wrote:

    > 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

    --
    <http://web0.greatbasin.net/~leo/
     
    Leonard Blaisdell, Aug 26, 2005
    #2
    1. Advertising

  3. ppcguy

    Spartanicus Guest

    "ppcguy" <> wrote:

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

    --
    Spartanicus
     
    Spartanicus, Aug 26, 2005
    #3
  4. ppcguy

    ppcguy Guest

    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
     
    ppcguy, Aug 26, 2005
    #4
  5. ppcguy wrote:

    > 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


    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Aug 26, 2005
    #5
  6. ppcguy wrote:
    > i've got a page that's very wide - e.g. 2000px.


    I put up this sample some time ago, when an identical question was
    asked. Well, almost identical. Perhaps it will give you some ideas.

    See 2000px wide stuff, and see browser window wide stuff.

    http://home.rochester.rr.com/bshagnasty/banner.html

    (and yes, this sample was 2000px wide when I first wrote it...)
    --
    -bts
    -This space intentionally left blank.
     
    Beauregard T. Shagnasty, Aug 26, 2005
    #6
  7. ppcguy

    Neredbojias Guest

    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

    --
    Neredbojias
    Contrary to popular belief, it is believable.
     
    Neredbojias, Aug 26, 2005
    #7
  8. ppcguy

    Toby Inkster Guest

    ppcguy wrote:

    > +--------------+------------------------------+
    > | | |
    > | Mesge | |
    > | | |
    > | This is the full logical web page. |
    > +-------------+--------------------------------+


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

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Aug 26, 2005
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Web Developer

    char 8bit wide or 7bit wide in c++?

    Web Developer, Jul 31, 2003, in forum: C++
    Replies:
    2
    Views:
    589
    John Harrison
    Jul 31, 2003
  2. Disc Magnet
    Replies:
    2
    Views:
    719
    Jukka K. Korpela
    May 15, 2010
  3. Disc Magnet
    Replies:
    2
    Views:
    793
    Neredbojias
    May 14, 2010
  4. Martin Rinehart

    80 columns wide? 132 columns wide?

    Martin Rinehart, Oct 31, 2008, in forum: Javascript
    Replies:
    16
    Views:
    181
    John W Kennedy
    Nov 13, 2008
  5. lawpoop
    Replies:
    4
    Views:
    147
    lawpoop
    Dec 4, 2008
Loading...

Share This Page