- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试使用 z-index 在着陆页上的标题/按钮的背景中放置一个图像(因为我使用背景颜色来创建叠加层),但是在我定位标题之前我无法让它工作/按钮作为绝对。现在无法悬停或选择按钮(显然需要单击)。
着陆页被分成两半,我没有将背景图片放在下半部分,按钮悬停很好,但在上半部分我留下了背景图片,我无法将鼠标悬停在按钮上。如果您找到解决方案,请解释我是如何误解的。
http://codepen.io/levane/pen/NNBOdM?editors=1100
<body>
<section id="landing-page">
<nav>
<button id="contact">Contact</button>
</nav>
<div id="top-half">
<header>
<h1>Artemis Levane</h1>
<h2>Web Designer & Front-End Developer</h2>
<button id="about-btn">Who I Am</button>
</header><img src="https://images.unsplash.com/photo-1442328166075-47fe7153c128?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=e18fcc3c0c7149c8ce315a176be812f0"/>
</div>
<div id="bottom-half">
<header>
<h3>Helping businesses & individuals bring their brands to the web</h3>
<button id="work-btn">What I Do</button>
</header><img src="/Personal/Images/Logo.png"/><br/>
<div id="bounce">
<button id="finger">☟</button>
</div>
</div>
</section>
* {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
font-family: Antonio;
}
#landing-page {
text-transform: uppercase;
}
nav {
width: 100%;
position: absolute;
}
button {
font-family: Antonio;
text-transform: uppercase;
}
#top-half {
height: 340px;
background: rgb(27, 40, 57);
color: rgb(240, 202, 0);
overflow: hidden;
}
#top-half header {
width: 50%;
height: 340px;
overflow: hidden;
margin-left: 25%;
margin-top: 5%;
text-align: center;
position: absolute;
}
#top-half img {
width: 100%;
opacity: 0.1;
}
#landing-page header h1 {
font-weight: 100;
font-size: 500%;
letter-spacing: 5px;
}
#landing-page header h2 {
font-size: 23;
font-weight: 400;
letter-spacing: 3px;
opacity: 0.7;
}
#about-btn {
border: 5px solid rgb(240, 202, 0);
padding: 5px 40px;
color: rgb(240, 202, 0);
letter-spacing: 4px;
margin-top: 5%;
}
#about-btn:hover {
color: rgb(27, 40, 57);
background: rgb(240, 202, 0);
}
#contact {
padding: 5px 40px;
color: rgb(240, 202, 0);
border: 3.5px solid rgb(240, 202, 0);
border-radius: 25px;
font-weight: 100;
letter-spacing: 3px;
text-align: center;
font-size: 15px;
margin-left: 87%;
margin-top: 1.1%;
}
#contact:hover {
color: rgb(27, 40, 57);
background: rgb(240, 202, 0);
}
#bottom-half {
height: 340px;
background-color: rgb(255, 246, 222);
color: rgb(27, 40, 57);
}
#bottom-half header {
position: absolute;
width: 60%;
margin-left: 24.8%;
margin-top: 7%;
}
#bottom-half header h3 {
font-size: 50px;
font-weight: 100;
letter-spacing: 3px;
}
#bottom-half img {
height: 87%;
margin-left: 470.5px;
margin-top: 2.5%;
opacity: .1;
}
#work-btn {
border: 5px solid rgb(27, 40, 57);
padding: 5px 40px;
color: rgb(27, 40, 57);
letter-spacing: 4px;
margin-left: 29.7%;
margin-top: 3%;
font-weight: 400;
}
#work-btn:hover {
color: rgb(255, 246, 222);
background: rgb(27, 40, 57);
}
/* ☟ FINGER BOUNCE ☟ */
@keyframes bounce {
0%, 20%, 50%, 80%, 100% {
-moz-transform: translateY(0);
-ms-transform: translateY(0);
-webkit-transform: translateY(0);
transform: translateY(0);
}
40% {
-moz-transform: translateY(-20px);
-ms-transform: translateY(-20px);
-webkit-transform: translateY(-20px);
transform: translateY(-20px);
}
60% {
-moz-transform: translateY(-15px);
-ms-transform: translateY(-15px);
-webkit-transform: translateY(-15px);
transform: translateY(-15px);
}
}
#finger {
margin-top: -10%;
font-size: 35px;
}
#bounce {
-moz-animation: bounce 4s infinite;
-webkit-animation: bounce 4s infinite;
animation: bounce 4s infinite;
}
/* END FINGER BOUNCE */
最佳答案
您可以通过设置更高的 z-index
来增加堆叠顺序值(value)。
nav {
...
position: absolute;
z-index: 1;
}
#top-half header {
...
position: absolute;
z-index: 1;
}
关于html - 悬停在使用位置 : absolute? 的按钮上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36812996/
今天有小伙伴给我留言问到,try{...}catch(){...}是什么意思?它用来干什么? 简单的说 他们是用来捕获异常的 下面我们通过一个例子来详细讲解下
我正在努力提高网站的可访问性,但我不知道如何在页脚中标记社交媒体链接列表。这些链接指向我在 facecook、twitter 等上的帐户。我不想用 role="navigation" 标记这些链接,因
说现在是 6 点,我有一个 Timer 并在 10 点安排了一个 TimerTask。之后,System DateTime 被其他服务(例如 ntp)调整为 9 点钟。我仍然希望我的 TimerTas
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我就废话不多说了,大家还是直接看代码吧~ ? 1
Maven系列1 1.什么是Maven? Maven是一个项目管理工具,它包含了一个对象模型。一组标准集合,一个依赖管理系统。和用来运行定义在生命周期阶段中插件目标和逻辑。 核心功能 Mav
我是一名优秀的程序员,十分优秀!