Making text appear padded inside div

Discussion in 'CSS' started by LanceT, Jan 14, 2008.

  1. #1
    So when I tried to set a padding, it makes the whole area slightly bigger. Is there anyway to make it so that when the text appears in the div, it will have some margin on the left and the right (so that the text isn't like crammed to the leftside of the div).

    I tried padding and margin and both those don't work. Padding makes the whole area shift or get bigger or something weird like that.
     
    LanceT, Jan 14, 2008 IP
  2. lock

    lock Banned

    Messages:
    205
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think you can give your div a set size using the height and width attributes in the css. If you use padding then you should be ok.

    Let me know if this works.
     
    lock, Jan 14, 2008 IP
  3. scubita

    scubita Peon

    Messages:
    5,550
    Likes Received:
    318
    Best Answers:
    0
    Trophy Points:
    0
    #3
    if you aply "padding-left: 10px" your DIV will get 10px bigger; so you gotta put minus 10px in width... same aplies in height: if you aply "padding-bottom: 5px", DIV will get 5px bigger in height, so you just have to put minus 5px in DIV heigh...

    If you can't do it pm i'll help ya out free of charge mate :D
     
    scubita, Jan 14, 2008 IP