Results 1 to 10 of 10

Thread: CSS Problem

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

    Default CSS Problem

    Hey when i set a padding for a box all it does is increase the size of the box.
    How do i stop this?

    css code
    Code:
    padding: 5px;

    Thread moved from Web design by --ss-- (Forum Super Moderator): Please post in the correct section .
    Last edited by --ss--; 08-02-2008 at 07:04 PM.
    Publishing free website designs, watch this space!
    Total number of designs published: 0
    Current work in progress: Landscape Design


  2. #2

    Default

    Just decrease the width of the box by the size of padding?

  3. #3
    Join Date
    Aug 2005
    Location
    London
    Posts
    9,773
    Tokens
    146

    Latest Awards:

    Default

    Quote Originally Posted by Jme View Post
    Just decrease the width of the box by the size of padding?
    That's what I normally do :eusa_whis

  4. #4
    Join Date
    Dec 2006
    Posts
    7,601
    Tokens
    95

    Latest Awards:

    Default

    Quote Originally Posted by Jme View Post
    Just decrease the width of the box by the size of padding?
    same here, decrease it by 5

  5. #5
    Join Date
    Nov 2007
    Posts
    753
    Tokens
    0

    Default

    Thanks, ive never had this problem before
    Publishing free website designs, watch this space!
    Total number of designs published: 0
    Current work in progress: Landscape Design


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

    Latest Awards:

    Default

    Probably because you aren't coding properly, I also used to change the width of the box, but I use the correct attributes and stuff now.

    e.g..

    <div class="box">
    content here
    </div>

    assuming the box class has no padding styled, and you just add padding: 5px, the box changes size/shape (cant remember exactly)

    however, using...

    <div class="box">
    <p>proper element or whatever</p>
    </div>

    then in the css ... .box p { padding: 5px; }

    everything is resolved

  7. #7
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    Could you not just use margin instead of padding :S?
    Coming and going...
    Highers are getting the better of me

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

    Latest Awards:


  9. #9
    Join Date
    Dec 2006
    Posts
    7,601
    Tokens
    95

    Latest Awards:

    Default

    Quote Originally Posted by MrCraig View Post
    Could you not just use margin instead of padding :S?
    no because the margin is how far away from other attributes. padding will indent stuff in the current box so its the same as an indent but moves all text/images

  10. #10
    Join Date
    Apr 2006
    Location
    London, England
    Posts
    696
    Tokens
    0

    Default

    Or alternatively you can create a wrapper and put margin on the layers within it.
    ;veni vidi vici
    ;i came, i saw, i ownt

Posting Permissions

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