CSS按钮在Google Chrome中不起作用?

问题描述 投票:3回答:1

我正在电影公司网站的主页上工作,它有一个具有悬停效果的CSS按钮,一旦准备好就可以打开灯箱,目前我将其设置为href =“# ”作为占位符,直到我准备实施灯箱。还有一个向下箭头的小图像,其中链接设置为页面上尚没有的锚点。两者在Firefox中均有效,但在Chrome中,悬停效果在按钮上不起作用,并且它们的行为就像这两个元素周围都没有定位标记一样。我在浏览器的Chrome浏览器的开发工具周围闲逛,似乎按钮周围的跨度可能是罪魁祸首,因为Chrome浏览器似乎正在调整其大小,但是我无法弄清图像链接无法正常工作的任何原因,我我不能完全确定为什么Chrome不同意跨度。

奇怪的是,另外三个具有悬停效果的CSS按钮在单独的div中,它们都可以正常工作。

该网站当前已上传到http://www.gruntwork.us/reelindi/test/样式表可以在http://www.gruntwork.us/reelindi/test/reelindi.css

中找到

CSS:

div.header {
    position:absolute;
    top: 0;
    left: 0;
    right: 0;
    background-image:url("resources/images/bg.jpg");
    background-size:cover;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    height:430px;
    width:100%;
    z-index: -1;
}
img.arrow {
    display: block;
    margin-left: auto;
    margin-right: auto;
    margin-top: 58px;
    z-index: 999;
}
span.redBtn a {
    text-align:center;
    display:block;
    margin: 0 auto;
    width: 150px;
    margin-top: -40px;
    z-index: 999;
}
a.redBtn {
    color: #fff;
    background-color: #d94d4d;
    font-size: 1.125em;
    padding: 8px 18px;
    text-decoration: none;
    text-align: center;
    -webkit-transition: all ease 1s;
    -moz-transition: all ease 1s;
    -o-transition: all ease 1s;
    -ms-transition: all ease 1s;
    transition: all ease 1s;
    border-radius: 5px;
}
a.redBtn:hover {
    background-color: #bf3030;
}

HTML:

<div class="header">
    <h1 class="header">Reel Indi</h1>
    <h2 class="header">"Storytelling in motion."</h2><br>
    <span class="redBtn"><a href="#" class="redBtn">Push the red button!</a></span>
    <a href="#footer"><img class="arrow" src="resources/images/arrow.png"></a>
</div>

我已经四处搜寻,但找不到答案。帮助?

css button hyperlink
1个回答
4
投票

好像您的headerz-index: -1规则将所有内容推到了身体内容的“后面”,导致您无法在该层上接收鼠标事件。将其更改为零或更高将使您具有悬停效果和其他事件。

© www.soinside.com 2019 - 2024. All rights reserved.