我的 HTML 网站中的导航按钮可以在 Chrome 和 Firefox 中呈现,但不能在 Safari 中呈现?

发布于 2025-01-10 14:56:09 字数 3198 浏览 0 评论 0原文

这里我遇到了一个问题,我的网站导航栏在 Chrome 和 Firefox 中呈现,但在 Safari 中根本不呈现。点击仍然有效,但我看不到按钮。

看这张图: 输入图片此处描述Firefox 位于左侧,Safari 位于右侧。

这是导航栏的 HTML 代码:

<nav class="topbar">
    <div class="nav_graphics">
        <a href="https://play.google.com/store/apps/dev?id=4853083882678511028" target="_blank">
            <img class="toxic_flame_icon" src="/images/toxicflame427_icon.png" alt="ToxicFlame427 Icon"/>
        </a>
        <h1 class="title_header">ToxicFlame427</h1>
    </div>

    <div class="nav_buttons">
        <!--Link the different pages to the main site-->
        <a href="/index.html">
            <button>
                <h3>Home</h3>
            </button>
        </a>
        <a href="/pages/my_creations.html">
            <button>
                <h3>My Creations</h3>
            </button>
        </a>
        <a href="/pages/about.html">
            <button>
                <h3>About</h3>
            </button>
        </a>
        <a href="/pages/bug_report.html"  class="report_bug_button">
            <button>
                <h3>Report A Bug</h3>
            </button>
        </a>
    </div>
</nav>

这里也是它的 CSS:

@font-face {
    font-family: "ArcadeClassic";
    src: url("/font/ArcadeClassic.woff");
}

.topbar{
    padding: 10px;
    align-content: flex-start;
    width: 100%;
    height: wrap;
    background-color: black;
}

.nav_graphics{
    display: flex;
}

.nav_buttons{
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
}

.title_header{
    font-family: "ArcadeClassic";
    font-size: 2.0em;
    vertical-align: top;
    display: inline-block;
    color: teal;
    margin-left: 20px;
    margin-right: 20px;
}

.toxic_flame_icon{
    display: inline-block;
    height: 100px;
    transition: 1s;
}

.toxic_flame_icon:hover{
    transform: rotate(180deg);
}

.topbar button{
    font-size: 0.9em;
    transition: 0.25s;
    -webkit-transition: 0.25s;
    -moz-transition: 0.25s;
    -o-transition: 0.25s;
    position: relative;
    bottom: 15px;
    border-radius: 5px;
    border-color: transparent;
    color: red;
    height: 15%;
    width: 130px;
    background-color: transparent;
    font-weight: bold;
    margin-top: 15px;
}

@media only screen and (max-width:600px){
    .topbar button{
        font-size: 0.8em;
    }

    .title_header{
        font-size: 1.7em;
    }
}

.topbar button:hover{
    color: turquoise;
    transform: translateY(-5px);
    -webkit-transform: translateY(-5px);
    -o-transform: translateY(-5px);
    -ms-transform: translateY(-5px);
    -moz-transform: translateY(-5px);
}

/*Make sure that the little blue lines cant be seen*/
.topbar a{
    color: transparent;
}

它可能与字体有关吗?或者还有什么我没注意到的?

如果有人需要查看更多代码,该网站位于 https://有毒火焰427.xyz

Here I have the issue where my navigation bar for my website renders in Chrome and Firefox, but in Safari, it does not render at all. The clicks still work, but I cannot see the buttons visually.

See this picture:
enter image description here
Firefox is on the left and Safari is on the right.

Here is the HTML code for the navigation bar:

<nav class="topbar">
    <div class="nav_graphics">
        <a href="https://play.google.com/store/apps/dev?id=4853083882678511028" target="_blank">
            <img class="toxic_flame_icon" src="/images/toxicflame427_icon.png" alt="ToxicFlame427 Icon"/>
        </a>
        <h1 class="title_header">ToxicFlame427</h1>
    </div>

    <div class="nav_buttons">
        <!--Link the different pages to the main site-->
        <a href="/index.html">
            <button>
                <h3>Home</h3>
            </button>
        </a>
        <a href="/pages/my_creations.html">
            <button>
                <h3>My Creations</h3>
            </button>
        </a>
        <a href="/pages/about.html">
            <button>
                <h3>About</h3>
            </button>
        </a>
        <a href="/pages/bug_report.html"  class="report_bug_button">
            <button>
                <h3>Report A Bug</h3>
            </button>
        </a>
    </div>
</nav>

And here is the CSS for it too:

@font-face {
    font-family: "ArcadeClassic";
    src: url("/font/ArcadeClassic.woff");
}

.topbar{
    padding: 10px;
    align-content: flex-start;
    width: 100%;
    height: wrap;
    background-color: black;
}

.nav_graphics{
    display: flex;
}

.nav_buttons{
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
}

.title_header{
    font-family: "ArcadeClassic";
    font-size: 2.0em;
    vertical-align: top;
    display: inline-block;
    color: teal;
    margin-left: 20px;
    margin-right: 20px;
}

.toxic_flame_icon{
    display: inline-block;
    height: 100px;
    transition: 1s;
}

.toxic_flame_icon:hover{
    transform: rotate(180deg);
}

.topbar button{
    font-size: 0.9em;
    transition: 0.25s;
    -webkit-transition: 0.25s;
    -moz-transition: 0.25s;
    -o-transition: 0.25s;
    position: relative;
    bottom: 15px;
    border-radius: 5px;
    border-color: transparent;
    color: red;
    height: 15%;
    width: 130px;
    background-color: transparent;
    font-weight: bold;
    margin-top: 15px;
}

@media only screen and (max-width:600px){
    .topbar button{
        font-size: 0.8em;
    }

    .title_header{
        font-size: 1.7em;
    }
}

.topbar button:hover{
    color: turquoise;
    transform: translateY(-5px);
    -webkit-transform: translateY(-5px);
    -o-transform: translateY(-5px);
    -ms-transform: translateY(-5px);
    -moz-transform: translateY(-5px);
}

/*Make sure that the little blue lines cant be seen*/
.topbar a{
    color: transparent;
}

May it have something to do with font? Or something else i did not catch?

The site is online at https://toxicflame427.xyz if anyone needs to see more code.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

从来不烧饼 2025-01-17 14:56:09

发生这种情况是因为您的 button 元素的高度为 15%,并且 Safari 和其他浏览器处理按钮内溢出的方式不同。

只需删除高度限制(或将其设置得更大)即可。

另外,附注:在两种浏览器中,按钮都没有覆盖其内容,这不是一个好的做法。另外,没有指定高度的 a 元素内的百分比高度也不好。

It's happening because your button element has 15% height and the way Safari and other browsers handle the overflow inside a button is different.

Simply remove the height restriction (or set it larger) and it will work.

Also, side note: in both browsers, the button is not covering its content and it's not a good practice. Plus, a percentage height inside an a element without a specified height is not good either.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文