Ignore parent padding

后端 未结 12 872
梦如初夏
梦如初夏 2021-01-30 19:23

I\'m trying to get my horizontal rule to ignore the parent padding.

Here\'s a simple example of what I have:

#par         


        
12条回答
  •  日久生厌
    2021-01-30 19:35

    The problem could come down to which box model you're using. Are you using IE?

    When IE is in quirks mode, width is the outer width of your box, which means the padding will be inside. So the total area left inside the box is 100px - 2 * 10px = 80px in which case your 100px wide


    will not look right.

    If you're in standards mode, width is the inner width of your box, and padding is added outside. So the total width of the box is 100px + 2 * 10px = 120px leaving exactly 100px inside the box for your


    .

    To solve it, either adjust your CSS values for IE. (Check in Firefox to see if it looks okay there). Or even better, set a document type to kick the browser into strict mode - where also IE follows the standard box model.

    
    
     ...
    

    http://www.quirksmode.org/css/quirksmode.html

提交回复
热议问题