我的代码工作中的所有链接除了这些链接

发布于 2025-01-26 19:07:21 字数 886 浏览 2 评论 0原文

这是我的HTML代码SOFAR的

<header>
    <div class="logo">
        <a href=""><img src="Images/samsung-logo.png" alt="Samsung Logo" width="150"></a>
        <ul class="menubalk">
            <a href=""><li>Contact</li></a>
            <a href="#assortiment-scroll"><li>Assortiment</li></a>
        </ul>
    </div>
</header>
<div class="bg">
        <video src="videos/S22-Ultra-unboxing.mp4" muted loop autoplay></video>
        <div class="bg-text">Nieuwe S22 Ultra</div>
        <a href=""><div class="bg-text-url">Discover</div></a>
</div>

最后一个链接,带有class =“ bg-text-url”工作,但前3个不做。 是我看不到某些内容还是...

编辑:当我刚开始启动项目时,它确实有效。此后,我还没有将任何内容更改为header

为了使它更容易:

This is my html code sofar

<header>
    <div class="logo">
        <a href=""><img src="Images/samsung-logo.png" alt="Samsung Logo" width="150"></a>
        <ul class="menubalk">
            <a href=""><li>Contact</li></a>
            <a href="#assortiment-scroll"><li>Assortiment</li></a>
        </ul>
    </div>
</header>
<div class="bg">
        <video src="videos/S22-Ultra-unboxing.mp4" muted loop autoplay></video>
        <div class="bg-text">Nieuwe S22 Ultra</div>
        <a href=""><div class="bg-text-url">Discover</div></a>
</div>

The last link with class="bg-text-url" work but the first 3 don't.
Am I not seeing something or ...

EDIT: when I first started the project it did work. And I haven't changed anything to the header since.

To make it easier: https://jsfiddle.net/x7ewtvqu/

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

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

发布评论

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

评论(3

梦屿孤独相伴 2025-02-02 19:07:21
<header>
    <div class="logo">
        <a href=""><img src="Images/samsung-logo.png" alt="Samsung Logo" width="150"></a>
        <ul class="menubalk">
            <li><a href="#">Contact</a></li>
            <li><a href="#">Assortiment</a></li>
        </ul>
    </div>
</header>
<div class="bg">
   <video src="videos/S22-Ultra-unboxing.mp4" muted loop autoplay></video>
   <div class="bg-text">Nieuwe S22 Ultra</div>            
   <div class="bg-text-url"><a href="#">Discover</a></div>
</div>

元素a在此上下文中不允许作为元素的孩子ul
同样,当您使用div element a不允许作为父母的孩子时。

<header>
    <div class="logo">
        <a href=""><img src="Images/samsung-logo.png" alt="Samsung Logo" width="150"></a>
        <ul class="menubalk">
            <li><a href="#">Contact</a></li>
            <li><a href="#">Assortiment</a></li>
        </ul>
    </div>
</header>
<div class="bg">
   <video src="videos/S22-Ultra-unboxing.mp4" muted loop autoplay></video>
   <div class="bg-text">Nieuwe S22 Ultra</div>            
   <div class="bg-text-url"><a href="#">Discover</a></div>
</div>

Element a not allowed as child of element ul in this context.
Also when you using a div element a not allowed as a parent child.

夕色琉璃 2025-02-02 19:07:21

您的锚定标记不起作用的原因是使用display:inline;样式和位置:absolute;。要解决此问题,请更新您的样式,以使其准确地更新为 this jsfiddle。我还纠正了您的一些语法。

The reason why your anchor tags are not working is a combination of using display: inline; styles and position: absolute;. To fix this issue, update your styles to be accurate to this JSFiddle. I have also corrected some of your syntax.

桃扇骨 2025-02-02 19:07:21
  1. 中使用div a标签在语义上是不正确的。您应该使用跨度标签。

  2. 不要在a标签中使用li。在li标签中使用a

  3. 如果要使用diva标签中只需使用:

     &lt; div style =“光标:指针;” onclick =“ window.location ='http://google.com';”&gt;
    你好世界
    &lt;/div&gt;
     

或使用:

<a href="http://google.com">
    <span style="display: block;">
        Hello world
    </span>
</a>

<header>
        <div class="logo">
        <a href=""><img src="https://media.istockphoto.com/vectors/abstract-business-arrow-up-logo-icon-vector-design-template-vector-id1140553971?k=20&m=1140553971&s=612x612&w=0&h=7-a1JjWAf8c5qKF46FRgdFg-3jva9qo80hqh0z_Y34A=" alt="Samsung Logo" width="150"></a>
        <ul class="menubalk">
            <li><a href="#">Contact</a></li>
            <li><a href="#assortiment-scroll">Assortiment</a></li>
        </ul>
    </div>
</header>

<div class="bg">
        <video src="videos/S22-Ultra-unboxing.mp4" muted loop autoplay></video>
        <div class="bg-text">Nieuwe S22 Ultra</div>
        <a href="#"><span class="bg-text-url">Discover</span></a>
</div>

  1. using div in a tag is semantically incorrect. You should use span tag.

  2. don't use li in a tag. Use a in li tag.

  3. if you want to use div in a tag just use:

    <div style="cursor: pointer;" onclick="window.location='http://google.com';">
    Hello world
    </div>
    

or use:

<a href="http://google.com">
    <span style="display: block;">
        Hello world
    </span>
</a>

<header>
        <div class="logo">
        <a href=""><img src="https://media.istockphoto.com/vectors/abstract-business-arrow-up-logo-icon-vector-design-template-vector-id1140553971?k=20&m=1140553971&s=612x612&w=0&h=7-a1JjWAf8c5qKF46FRgdFg-3jva9qo80hqh0z_Y34A=" alt="Samsung Logo" width="150"></a>
        <ul class="menubalk">
            <li><a href="#">Contact</a></li>
            <li><a href="#assortiment-scroll">Assortiment</a></li>
        </ul>
    </div>
</header>

<div class="bg">
        <video src="videos/S22-Ultra-unboxing.mp4" muted loop autoplay></video>
        <div class="bg-text">Nieuwe S22 Ultra</div>
        <a href="#"><span class="bg-text-url">Discover</span></a>
</div>

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