父 DIV 中的圆角不影响子 DIV
所以,我正在尝试在 CSS3 中使用圆角(不在 IE 中,不关心它是否在那里工作),并且我有一个 DIV,我的所有内容都在其中看起来非常漂亮。我遇到的问题是,有些子 DIV 没有被父级的圆角“掩盖”。我不是在寻找孩子继承圆角。我只想让父级内部的任何内容在四舍五入的地方不可见,就好像它被屏蔽一样。我尝试使用“overflow:hidden;”,但这似乎并不能解决问题。
有谁知道圆角容器 DIV 的子级如何被父级 DIV 屏蔽?如果有任何用处,我正在使用“position:absolute;”在父 DIV 上。不确定这是否会产生任何影响。
谢谢!
So, I'm experimenting with using rounded-corners in CSS3 (not in IE, don't care if it works there), and I have the DIV where all of my content lives looking quite nice. The problem I'm having is that there are child DIVs that are not getting "masked" by the parent's rounded corners. I'm not looking for the child to inherit the rounded-corners. I just want to have any content inside the parent to not be visible where it is rounded, as if it were masked. I tried using "overflow: hidden;", but that doesn't seem to do the trick.
Does anyone have any ideas how the children of the rounded-cornered container DIV can be sorta masked by the parent DIV? If it's of any use, I'm using "position: absolute;" on the parent DIV. Not sure if that will make any difference.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试将
overflow:hidden;
添加到父元素。这解决了我的问题。Try adding
overflow: hidden;
to the parent element. This fixed the problem for me.在 div 上使用内边距。如果使填充等于半径,则不必担心任何重叠或圆形区域中出现的内容。
这是一个有用的网站,讨论了有关 CSS3 边框半径的所有内容:http://www.css3。信息/预览/圆角边框/。
Use padding on the div. If you make the padding equal to the radius you shouldn't have to worry about any overlap or the content appearing in the rounded areas.
Here is a helpful site that talks all about the CSS3 Border Radius: http://www.css3.info/preview/rounded-border/.