Results 1 to 5 of 5

Thread: DIV Questions

  1. #1
    Join Date
    Nov 2006
    Location
    D?sseldorf
    Posts
    2,858
    Tokens
    2,256

    Latest Awards:

    Default DIV Questions

    Hey, not familiar with divs and css, so got a couple of questions.

    I have the container, and i want it in the center of the screen, but i don't want the text centered, how would I go about this?

    And in this content box, how would i put a 5px "indent" on the left and right so the text isn't right at the edge like this:


    Many Thanks
    Luke

  2. #2
    Join Date
    Nov 2006
    Location
    Narrich
    Posts
    5,687
    Tokens
    0
    Habbo
    Jamesy...

    Latest Awards:

    Default

    First one:

    margin-right:auto;
    margin-left:auto;

    Second:
    padding-left:<number>px;
    padding-right:<number>px;
    Ex-janitor. Might pop in from time to time, otherwise you can grab all my information from http://jamesy.me.uk/

  3. #3
    Join Date
    Nov 2006
    Location
    D?sseldorf
    Posts
    2,858
    Tokens
    2,256

    Latest Awards:

    Default

    Quote Originally Posted by Jamesy View Post
    First one:

    margin-right:auto;
    margin-left:auto;

    Second:
    padding-left:<number>px;
    padding-right:<number>px;
    Thanks, however the padding done this:

  4. #4
    Join Date
    Nov 2006
    Location
    Narrich
    Posts
    5,687
    Tokens
    0
    Habbo
    Jamesy...

    Latest Awards:

    Default

    minus from the width the sum of the padding.

    For example if your code was:

    HTML Code:
    width:200px;
    padding-left:10px;
    padding-right:10px;
    you'd change the width to be 180px to counter act the addition of padding.
    Ex-janitor. Might pop in from time to time, otherwise you can grab all my information from http://jamesy.me.uk/

  5. #5
    Join Date
    Nov 2006
    Location
    D?sseldorf
    Posts
    2,858
    Tokens
    2,256

    Latest Awards:

    Default

    Quote Originally Posted by Jamesy View Post
    minus from the width the sum of the padding.

    For example if your code was:

    HTML Code:
    width:200px;
    padding-left:10px;
    padding-right:10px;
    you'd change the width to be 180px to counter act the addition of padding.
    That's great! Thanks +rep
    Edit: Gotta spread, sorry

Posting Permissions

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