父div的边界阻止子div [英] parent div's border blocking child div

查看:108
本文介绍了父div的边界阻止子div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个父div和一个子div.父div具有border-width属性,但不幸的是,border-width阻止了子div的一部分被显示.父div的border-width属性无法更改.如何让子div显示在父div的边框上方?

I have a parent div and a child div. The parent div has a border-width property, but unfortunately that border-width is blocking part of the child div from being shown. The border-width property of the parent div cannot be changed. How can I get the child div to show up above the parent div's border?

应注意,父div的位置:绝对值已应用,子div的位置未在CSS中应用,并且仅显示了子div的左右边缘,因为只有border-left和border -父div的权利已设置.

Should note that the parent div has position: absolute applied, the child div does not have position applied in the CSS, and only the left and right edges of the child div are not shown, since only the border-left and border-right of the parent div are set.

推荐答案

查看示例: http://jsfiddle.net/LGR8w/

一旦定位了元素,就可以使子div重叠父对象的边界,而不仅仅是简单地扩展父对象以适合其内容. (尽管您想这样做的原因超出了我).

Once the elements are positioned, you are able to make the child div overlap the parent's border instead of simply expanding the parent to fit the content. (though why you want to do that is beyond me).

如果我错了,可以请您向我解释为什么要让孩子和父母的内容重叠,而不是简单地使父母扩展以适合孩子的需求?除非这是用于样式重叠的设计,否则我不明白为什么这样做是必要的.

If I'm wrong, could you please explain to me why you want to make the child and parent content overlap rather than simply making the parent expand to properly fit the child? Unless this is for a stylistic overlapping design, I don't see why this is necessary.

这篇关于父div的边界阻止子div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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