【问题标题】:How can I stop my parallax overlay from interfering with my form and link fields?如何阻止我的视差覆盖干扰我的表单和链接字段?
【发布时间】:2018-02-14 02:31:40
【问题描述】:

我已经在我的 PHP 网站的索引页面中实现了简单的视差图像。出于某种原因,由于我实现的视差标头,登录表单行为异常。在那张照片上有一个由我命名为 logo 的 div 放置的图像叠加层。我可以肯定这是罪魁祸首,因为当我将其注释掉时,表单字段和链接就会起作用。该网站位于http://www.mattmacy.com/greenia/。请注意表单字段不起作用。我已经为我的 3 张图片和徽标类包含了我的 css。任何帮助将不胜感激。

<!DOCTYPE html>
<html>
<head>
<title>FORUM</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>

<body style="background-color: maroon";>
<div style= "background-color: gold; border-style: solid;">

//This "logo" div stops my form and link fields from working  
<div class="pimg1">
<div class="logo"></div>
</div>

<div style="background-color: gold; border-style: solid;">
<h1>Matt Macy's Forum</h1>

<?php
session_start();
if (!isset($_SESSION['uid'])){
echo "<form action='login_parse.php' method='post'>
Username: <input type='text' name='username' />&nbsp;
Password: <input type='password' name='password' />&nbsp;
<input type='submit' name='submit' value='Log In'/></form>";
echo "You can joing this site with Admin approval <a 
href='register.php' class='Links'>Register</a>";
}else {
    echo "You are logged in as ". $_SESSION['username']. "with a level 
of " . $_SESSION['level']."<a href='logout_parse.php' 
class='Links'>Logout</a>";
}   if (isset($_SESSION['level']) && ($_SESSION['level'] == 'Admin')){
        echo "<a href='authenticate.php' 
class='authenticate'>Authenticate</a>";
        echo "<a href='postAudiowithPayPal.php' 
class='postAudiowithPayPal'>Post audio with PayPal</a>";

}
echo"</div><br>";
//This is my second parallax image that doesn't cause difficulty
echo"<div class='pimg2'><span class='border'></span></div>";

这是来自我的 style.css 文件。我不确定是否需要为我为链接指定的链接类设置样式。

.pimg1{
background-image:url('pimg1.jpg');
min-height:100%;
height:600px;
}

.pimg2{
background-image:url('pimg2.jpg');
min-height:100%;
height:500px;
}
.pimg3{
background-image:url('pimg3.jpg');
min-height:100%;
height:500px;
}

@media(max-width:568px){
.pimg1, .pimg2, .pimg3{
    background-attachment: scroll;
}
}

.logo{
height: 100%;
width: 100%;
background-image:url('SpiritualAutomaton2.png');
position: center;
background-repeat: no-repeat;
position: absolute;
top:50%;
margin-top:-50px;
margin-left:130px;


}
.Links{
      ?
}

【问题讨论】:

    标签: html css parallax


    【解决方案1】:

    问题在于您的.logo 高度。尝试使用与您用作背景的图像相同的大小。您可以在此图像中看到,将鼠标放在最左侧的输入上并向右移动,徽标 div 会阻止下面的元素。另一种选择是在.logo 元素上设置pointer-events:none;,但在这种情况下这有点难。

    【讨论】:

    • 我更改了高度以匹配图像:高度:1667px;我仍然在这些领域遇到问题。
    • 该徽标图像高 173 像素,而不是 1667 像素。您在 .logo 上设置了 height: 100%; - 将其更改为 height: 173px;
    • 哦,您的意思是徽标的像素。我以为你的意思是背景谢谢
    猜你喜欢
    • 1970-01-01
    • 2015-10-18
    • 2014-10-23
    • 2015-04-21
    • 1970-01-01
    • 2020-12-26
    • 1970-01-01
    • 2019-10-18
    • 2018-02-28
    相关资源
    最近更新 更多