使子元素溢出具有隐藏溢出的元素

时间:2013-10-14 23:00:20

标签: html css3 css

我有一个元素,它有一个 overflow-x:hidden overflow-y:visible ,里面是一个绝对位置的元素,我想在它上面溢出。 我认为,如果我给父元素一个 overflow-y:hidden 那么它会起作用,但浏览器只是添加一个滚动条而不是让子元素溢出父元素。

这是一个演示我的情况的小提琴:

<!DOCTYPE html>
<html>
<head>
<style> 
div
{
width:110px;
height:110px;
border:thin solid black;
overflow-x:hidden;
overflow-y: visible;
position: relative;
}
</style>
</head>
<body>

<div><p style="position: absolute;">
In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since.
'Whenever you feel like criticizing anyone,' he told me, 'just remember that all the people in this world haven't had the advantages that you've had.' 
</p></div>

<p>Overflow-x specifies whether or not to clip the left/right edges of the content.</p>
<p>Overflow-y specifies whether or not to clip the top/bottom edges of the content.</p>

</body>
</html>

http://jsfiddle.net/QNDJj/

0 个答案:

没有答案