positioning in css

Discussion in 'HTML' started by Ike, Feb 13, 2004.

  1. Ike

    Ike Guest

    Can anyone show me an example of simple positioning using a css? Something
    along the lines of positioning something at 0,0 (top,left) ?

    Thanks, Ike
    Ike, Feb 13, 2004
    #1
    1. Advertising

  2. Ike

    GD Guest

    Ike <> wrote:
    > Can anyone show me an example of simple positioning using a css?


    If you mean absolute positioning:

    #foo {
    position:absolute;
    z-index:2;
    top:0;
    left:0;
    width:100%;
    background:#000;
    color:#fff;
    }

    Then in the HTML:

    <div id="foo">This is absolute positioning</div>


    Relative positioning works differently. It doesn't remove the element
    from the flow of the page, it just offsets the element from its original
    position after it's been drawn:

    p em {
    position:relative;
    top:-1em;
    left:1em;
    background:#f00;
    color:#ff0;
    }


    Then in the HTML:

    <p>This is <em>relative</em> positioning</p>
    GD, Feb 13, 2004
    #2
    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:
    360
    Kevin Spencer
    Apr 7, 2004
  2. Eric

    Datalist and CSS positioning

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

    Re: css positioning vs. tables

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

    Re: CSS positioning help - Mozilla

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

Share This Page