忽略父填充 [英] Ignore parent padding

查看:91
本文介绍了忽略父填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取水平规则以忽略父填充.

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

这是我所拥有的一个简单示例:

Here's a simple example of what I have:

#parent {
  padding:10px;
  width:100px;
}
hr {
  width:100px;
}

您会发现水平线超出了父级10像素.我试图让它忽略父div中其他所有内容所需的填充.

You will find that the horizontal rule extends out of the parent by 10px. I'm trying to get it to ignore the padding that everything else in the parent div needs.

我知道我可以为其他所有内容创建一个单独的div;这不是我要找的解决方案.

I'm aware that I could make a separate div for everything else; this is not the solution I'm looking for.

推荐答案

轻松修复,只需

margin:-10px

在小时上.

这篇关于忽略父填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆