Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: CSS/Div Help

  1. #1
    Join Date
    Nov 2007
    Posts
    88
    Tokens
    0

    Default CSS/Div Help

    How do I get a div to appear in a certain place on the page.
    Such as
    Code:
    .main {
        width: 500px;
        float: 200px;
    }
    Code:
    <div class="main">Main Content</div>
    This doesn't work by the way.

    So I want it to appear 200px in from the side, but I don't know how to do this, any help please.

  2. #2
    Join Date
    Feb 2006
    Location
    Ontario Canada
    Posts
    4,587
    Tokens
    0

    Latest Awards:

    Default

    margin-left:200px;

    .:.:#14:.:. .:.: Impossible Is Nothing :.:. .:.: 845 Rep:.:.
    .:.: Stand up for what is right, even if you stand alone:.:.


  3. #3
    Join Date
    Nov 2007
    Posts
    88
    Tokens
    0

    Default

    Doesn't really matter now because it is tottally different in IE and in FF.

    Cheers for the help though.

  4. #4
    RedCrisps Guest

    Default

    i would use the space bar :]

  5. #5
    Join Date
    Jul 2005
    Posts
    1,653
    Tokens
    50

    Latest Awards:

    Default

    You can't use the space bar because only 1 space would be counted...

    It's happened because you are using float: 200px;

    You can only use float: left or right;

  6. #6
    RedCrisps Guest

    Default

    &nbsp;
    so yah :]

  7. #7
    Join Date
    Dec 2006
    Posts
    3,970
    Tokens
    0

    Latest Awards:

    Default

    use;

    margin-left: 200px;

    or

    body {padding-left: 200px;}
    Lets set the stage on fire, and hollywood will be jealous.

  8. #8
    Join Date
    Aug 2005
    Location
    Newcastle
    Posts
    1,417
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by SmileUK View Post
    How do I get a div to appear in a certain place on the page.
    Such as
    Code:
    .main {
        width: 500px;
        float: 200px;
    }
    Code:
    <div class="main">Main Content</div>
    This doesn't work by the way.

    So I want it to appear 200px in from the side, but I don't know how to do this, any help please.
    Have a try with:
    Code:
    // CSS Code
    .main {width: 500px;     float: left;     margin-left: 200px;}
    Code:
    <!-- HTML Code -->
    <div class="main"> Floating left with 200px margin! Possibly add padding?</div>
    Great to see someone expanding their knowledge.
    Last edited by craigg.; 28-11-2007 at 05:10 PM.



  9. #9
    Join Date
    Jul 2005
    Posts
    1,653
    Tokens
    50

    Latest Awards:

    Default

    Just a tip to the OP, main is only usually used once, so use an id, #main { } and <div id="main"> etc.

  10. #10
    Join Date
    Aug 2005
    Location
    Newcastle
    Posts
    1,417
    Tokens
    0

    Latest Awards:

    Default

    Classes can be applied more than once, ID's cant. (Just to clarify what Ryan had said)



Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •