基本上我的目标是:
然而,我无法使div(如img)显示在div之上。如果some1可以建议如何垂直和水平居中箭头,我将不胜感激。
这是我得到的:
section.main{
background-image: url(images/main.png);
overflow: auto;
padding: 290px 0px;
max-width: 1920px;
position: relative;
div{
height: 83px;
width: 83px;
background-color: #fff;
opacity: 0.5;
line-height: 83px;
vertical-align: middle;
text-align: center;
}
img.arr{
z-index: 100;
}
div.btnLeft{
float: left;
}
div.btnRight{
float: right;
}
p{
font-family: 'Playfair Display', sans-serif;
font-style: italic;
color: #fff;
font-size: 32px;
position: absolute;
top: 316px;
left: 375px;
}

<section class="main">
<p>Laisve kurti ir veikti!</p>
<div class="btnLeft">
<img class="arr" src="images/al.png">
</div>
<div class="btnRight">
<img class="arr" src="images/ar.png">
</div>
</section>
&#13;
谢谢!
答案 0 :(得分:1)
你可以使用伪
在没有任何图像的情况下做到这一点
section.main {
background-image: url(images/main.png);
overflow: auto;
padding: 90px 0px;
max-width: 1920px;
position: relative;
}
div {
position: relative;
height: 83px;
width: 83px;
background-color: lightgray;
opacity: 0.5;
}
div::after {
content: '>';
font-weight: bold;
font-size: 60px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
div.btnLeft::after {
content: '<';
}
div.btnLeft {
float: left;
}
div.btnRight {
float: right;
}
p {
font-family: 'Playfair Display', sans-serif;
font-style: italic;
color: #fff;
font-size: 32px;
position: absolute;
top: 316px;
left: 375px;
}
<section class="main">
<p>Laisve kurti ir veikti!</p>
<div class="btnLeft">
</div>
<div class="btnRight">
</div>
</section>
如果您仍想要图像,请按照这样添加
div::after {
content: url(images/ar.png);
}
div.btnLeft::after {
content: url(images/al.png);
}