我想实现这一点。留意顶部文字'开心果'。当它嵌套在盒子中时,我想要覆盖盒子。 显示包含元素之外的文本
body {
background: yellow;
padding: 50px;
}
.slider {
width: 100%;
height: 650px;
margin-top: 40px;
background: orange;
box-shadow: 0 0 78px 11px #F3286B;
}
h1, h2 {
text-transform:uppercase;
color: red;
}
h1 {
font-size: 11vw;
}
h2 {
font-size: 7vw;
}
<body>
<div class="slider">
<h1>
Happy Fruit
</h1>
<h2>
HELLO WORLD
</h2>
</div>
</body>
如果我当时去添加margin-top: -50px;
到H1文本将留在div里面,但我怎么可以让它去上面/站在它就可以了,而它仍然嵌套在(html)内?我试过玩z-index
,但没有奏效。
position: relative; top: -50px;
'H1 {位置:相对;顶部:-50px;}' – UncaughtTypeError
这不起作用,然后发生这种情况(检查img在更新后) – Panic
'.slider {overflow:visible;}'看起来是一个简单的溢出问题,事情是,应用此解决方案在所提供的代码片段中是有效的,因此如果它不适用于您的生产环境,那么您还没有将其他样式或因素包含在您提供给我们处理和排除故障的代码中。 – UncaughtTypeError