Ignore parent padding

后端 未结 12 876
梦如初夏
梦如初夏 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:47

    Kinda late.But it just takes a bit of math.

    .content {
      margin-top: 50px;
      background: #777;
      padding: 30px;
      padding-bottom: 0;
      font-size: 11px;
      border: 1px dotted #222;
    }
    
    .bottom-content {
      background: #999;
      width: 100%; /* you need this for it to work */
      margin-left: -30px; /* will touch very left side */
      padding-right: 60px; /* will touch very right side */
    }
    
    

    A paragraph

    Another paragraph.

    No more content

    I want this div to ignore padding.

    I don't have Windows so I didn't test this in IE.

    fiddle: fiddle example..

提交回复
热议问题