Search code examples
phphtmlcssmobilemobile-website

can't click anything on my website, in mobile view


Google keeps giving me results based on fixing my phone, but the problem is on my website. This is a weird problem, but on a mobile device on my website, I can't click any buttons or links. desktop works fine, but mobile is having issues. I'm making this site directly on cpanel, so I don't know if there is some special code I need to add to detect mobile taps, I usually use wordpress, so I don't know a whole lot about making a website directly on mysqli. The mobile taps will work outside a container, but I need it to work inside my page container. its inside a <div> and a <pre>. I don't really understand the problem, here is what some of my code looks like:

Global Styles:

pre{
    border: solid 3px #2b333d;
    border-radius: 10px;
    font-size: 15px;
    color: #3c3d3c;
    margin: 1%;
    padding: 10px;
    background: #eaeaea;
    display: block;
    font-family: monospace;
    white-space: pre-wrap;
}

input{
    border: solid 2px #2b333d;
    border-radius: 10px;
    font-size: 15px;
    color: #3c3d3c;
    margin: 1%;
    padding: 8px;
    background: #f7f7f7;
    font-family: Arial, Helvetica, sans-serif;
    white-space: pre-wrap;
    outline: none;
    display: inline-block;
}

input[type=button], input[type=submit], input[type=reset]{
    border: solid 2px #142135;
    border-radius: 10px;
    font-size: 18px;
    color: #f7f7f7;
    margin: 1%;
    padding: 5px 7px;
    background: #5791ed;
    font-family: Arial, Helvetica, sans-serif;
    white-space: pre-wrap;
    outline: none;
    letter-spacing: 0;
    display: inline-block;
}

form{
    line-height: 0.2;
    white-space: normal;
}

Page/Header Styles:

.page_m{
    background: #fcfcfc;
    width: 99.9%;
    left: 0.1%;
    z-index: -20;
    top: 30px;
    position: relative;
}

.page_inner_m{
    padding: 20px;
    z-index: -20;
    position: relative;
    font-family: Arial, Helvetica, sans-serif;
    white-space: pre-wrap;
    color: #2d2d2d;
    letter-spacing: 0.5;
    line-height: 1.55;
    border: 0;
    border-radius: 0;
    font-size: 18px;
    margin: 0;
    background: none;
    display: block;
}

scripts:

<?php

?>
<style>
<?php include 'header.css'; ?>
</style>
<?php

echo '<div class="page_m">';

?>
<style>
<?phpinclude 'style_m.css';?>
</style>
<?php

echo '<pre class="page_inner_m">';

//header start
echo '<div class="menu_m">';

$host = $_SERVER['HTTP_HOST'];
preg_match("/[^\.\/]+\.[^\.\/]+$/", $host, $matches);
$domain = "{$matches[0]}\n";

echo '<center class="title_m">'.$domain.'</center>';
echo '</div>';
//header end

echo '</pre></div>';
echo '</div>';
?>

Solution

  • Fixed it :D just needed to replace echo '<pre class="page_inner_m">'; with echo '<body class="page_inner_m">'; and replace echo '</pre></div>'; with echo '</body></div>';

    I'll keep this up incase anyone else finds it helpful. switching the <pre> tag with a <body> tag solved the problem for me.