Css Positioning "Screen-Width-Relative"

Discussion in 'HTML' started by Rob Powell, Sep 17, 2006.

  1. Rob Powell

    Rob Powell Guest

    hi all

    i was wondering

    is there a way to give a CSS class a position screen-width-relative? ie,
    can i have a class having some properties like "horizontal positioning =
    (screen.width / 2) - 350"... ? :)

    thanks in advance
    rob
    Rob Powell, Sep 17, 2006
    #1
    1. Advertising

  2. Rob Powell

    dorayme Guest

    In article <eei7oi$i1p$>,
    Rob Powell <> wrote:

    > hi all
    >
    > i was wondering
    >
    > is there a way to give a CSS class a position screen-width-relative? ie,
    > can i have a class having some properties like "horizontal positioning =
    > (screen.width / 2) - 350"... ? :)
    >
    > thanks in advance
    > rob


    You can position a box in a browser with CSS. But you need more
    to instruct for the monitor itself. You may have some success
    with javascript.

    --
    dorayme
    dorayme, Sep 17, 2006
    #2
    1. Advertising

  3. Rob Powell wrote:
    > hi all
    >
    > i was wondering
    >
    > is there a way to give a CSS class a position screen-width-relative? ie,
    > can i have a class having some properties like "horizontal positioning =
    > (screen.width / 2) - 350"... ? :)
    >
    > thanks in advance
    > rob


    Not directly, but this way will do it:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <style type="text/css">
    #pushpin {
    position: absolute; left: 50%; margin-left: -350px;
    width: 10em; border: 1px solid black;
    }
    </style>
    </head>
    <body>

    <div id="pushpin">Here I am!</div>
    </body>
    </html>




    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Sep 17, 2006
    #3
  4. Rob Powell wrote:
    > is there a way to give a CSS class a position screen-width-relative?


    Why? That's just going to be horrible for anyone who doesn't run their
    browser maximised.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
    David Dorward, Sep 17, 2006
    #4
  5. Rob Powell

    dorayme Guest

    In article <eejarl$i0o$1$>,
    David Dorward <> wrote:

    > Rob Powell wrote:
    > > is there a way to give a CSS class a position screen-width-relative?

    >
    > Why? That's just going to be horrible for anyone who doesn't run their
    > browser maximised.


    Yes, I was wondering about this. (JL's answer to OP seemed
    intriguingly clever).

    --
    dorayme
    dorayme, Sep 17, 2006
    #5
    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. Guest

    OT ...CSS positioning

    Guest, Apr 7, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    356
    Kevin Spencer
    Apr 7, 2004
  2. Eric

    Datalist and CSS positioning

    Eric, Sep 14, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    555
    =?Utf-8?B?Q3VydF9DIFtNVlBd?=
    Sep 14, 2005
  3. PeterMcC

    Re: css positioning vs. tables

    PeterMcC, Jun 23, 2003, in forum: HTML
    Replies:
    0
    Views:
    841
    PeterMcC
    Jun 23, 2003
  4. David Graham

    Re: CSS positioning help - Mozilla

    David Graham, Jun 28, 2003, in forum: HTML
    Replies:
    1
    Views:
    5,485
    Lorne Cameron
    Jun 28, 2003
  5. brucie
    Replies:
    8
    Views:
    1,994
    Wipkip
    Jun 29, 2003
Loading...

Share This Page