我怎麼能使這個按鈕的innerHTML不隱藏在那些顏色後面。因爲現在它就像幕後,如果我改變按鈕的顏色和透明度我看不到後面的文本。(帶圖像更新)水平六角形按鈕css
body .btn-main {
position: relative;
display: block;
background: transparent;
width: 200px;
height: 60px;
line-height: 60px;
text-align: center;
font-size: 15px;
text-decoration: none;
text-transform: uppercase;
margin: 40px auto;
cursor: pointer;
color: black; }
body .btn-main span {
z-index: 100; }
body .btn-main:before, body .btn-main:after {
width: 200px;
left: 0px;
height: 27px;
z-index: 1; }
body .btn-main:after {
position: absolute;
top: 34px;
opacity: 0.4;
background: #5E3553;
content: '';
border-top: none;
-webkit-transform: perspective(15px) rotateX(-5deg);
-moz-transform: perspective(15px) rotateX(-5deg);
transform: perspective(15px) rotateX(-5deg); }
body .btn-main:before {
position: absolute;
content: '';
opacity: 0.6;
background: #5E3553;
border-bottom: none;
-webkit-transform: perspective(15px) rotateX(5deg);
-moz-transform: perspective(15px) rotateX(5deg);
transform: perspective(15px) rotateX(5deg); }
body .btn-main:before, body .btn-main:after {
z-index: -1;
border: 2px solid #5E3553; }
body .main-img {
background-image: url(https://static.pexels.com/photos/4827/nature-forest-trees-fog.jpeg);
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
background-color: #464646;
height: 1000px; }
<div class="main-img">
<div class="button btn-main"><span>Trial Now!</span></div>
</div>
真的很有用,但它會工作,如果它將是背景圖像? – ddeadlink
對不起?請更具體一些。 –
救了我一天。我最好的問候和謝謝你 – ddeadlink