AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / coding / 问题 / 79029397
Accepted
Jlv
Jlv
Asked: 2024-09-27 07:25:06 +0800 CST2024-09-27 07:25:06 +0800 CST 2024-09-27 07:25:06 +0800 CST

个别路径的 CSS 样式不起作用

  • 772

我有一个视觉效果,其中有 11 个热点,分布在 png 图形周围。我为每个热点创建了单独的路径,并希望创建一个链接以及一个悬停,该悬停会改变颜色以显示所选区域。链接和悬停适用于列表中的第一个图形,但不适用于以下任何图形。CSS 为:

 #path_cm:hover, #path_rm:hover, #path_is:hover, #path_bc:hover, #path_hr:hover, #path_ict:hover, #path_sc:hover, #path_fa:hover, #path_env:hover, #path_hs:hover, #path_em:hover  {
    opacity: .5
  }

HTML 是(删除了许多行 png 图形,第二个 python url 变量是一个占位符,用于查看是否需要 url 来激活悬停并将其替换为真实的 url):


 <div class='containervert' style='top: 5%;'>
        <?xml version="1.0" encoding="UTF-8"?>
        <!-- Generated by Pixelmator Pro 3.6.9 -->
        <svg width="720" height="688" viewBox="0 0 720 688" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">


(png data)

            <a href='{% url 'introduction' %}'>
            <path id="path_cm" fill="#027aff" stroke="none" opacity="0" d="M 707.76001 330.686188 C 707.76001 311.409363 692.125793 295.78241 672.840027 295.78241 C 653.554199 295.78241 637.919983 311.409363 637.919983 330.686188 C 637.919983 349.963013 653.554199 365.589966 672.840027 365.589966 C 692.125793 365.589966 707.76001 349.963013 707.76001 330.686188 Z"/>
            <a>
            <a href='{% url 'introduction' %}'>
            <path id="path_rm" fill="#027aff" stroke="none" opacity="0" d="M 676.919983 195.78241 C 676.919983 176.452454 661.249939 160.78241 641.920044 160.78241 C 622.590027 160.78241 606.919983 176.452454 606.919983 195.78241 C 606.919983 215.112366 622.590027 230.78241 641.920044 230.78241 C 661.249939 230.78241 676.919983 215.112366 676.919983 195.78241 Z"/>
            <a>
            <path id="#path_is" fill="#027aff" stroke="none" opacity="0" d="M 532.919983 52.78241 C 532.919983 33.452454 517.249939 17.78241 497.920013 17.78241 C 478.589996 17.78241 462.919983 33.452454 462.919983 52.78241 C 462.919983 72.112366 478.589996 87.78241 497.920013 87.78241 C 517.249939 87.78241 532.919983 72.112366 532.919983 52.78241 Z"/>
            <path id="#path_bc" fill="#027aff" stroke="none" opacity="0" d="M 707.919983 330.78241 C 707.919983 311.452454 692.249939 295.78241 672.920044 295.78241 C 653.590027 295.78241 637.919983 311.452454 637.919983 330.78241 C 637.919983 350.112366 653.590027 365.78241 672.920044 365.78241 C 692.249939 365.78241 707.919983 350.112366 707.919983 330.78241 Z"/>
            <path id="#path_hr" fill="#027aff" stroke="none" opacity="0" d="M 82.919983 332.78241 C 82.919983 313.452454 67.249954 297.78241 47.920013 297.78241 C 28.59001 297.78241 12.919983 313.452454 12.919983 332.78241 C 12.919983 352.112366 28.59001 367.78241 47.920013 367.78241 C 67.249954 367.78241 82.919983 352.112366 82.919983 332.78241 Z"/>
            <path id="#path_ict" fill="#027aff" stroke="none" opacity="0" d="M 676.919983 467.78241 C 676.919983 448.452454 661.249939 432.78241 641.920044 432.78241 C 622.590027 432.78241 606.919983 448.452454 606.919983 467.78241 C 606.919983 487.112366 622.590027 502.78241 641.920044 502.78241 C 661.249939 502.78241 676.919983 487.112366 676.919983 467.78241 Z"/>
            <path id="#path_sc" fill="#027aff" stroke="none" opacity="0" d="M 195.919983 570.78241 C 195.919983 551.452454 180.249954 535.78241 160.920013 535.78241 C 141.590012 535.78241 125.919983 551.452454 125.919983 570.78241 C 125.919983 590.112366 141.590012 605.78241 160.920013 605.78241 C 180.249954 605.78241 195.919983 590.112366 195.919983 570.78241 Z"/>
            <path id="#path_fa" fill="#027aff" stroke="none" opacity="0" d="M 311.919983 627.78241 C 311.919983 608.452454 296.249969 592.78241 276.920013 592.78241 C 257.589996 592.78241 241.919983 608.452454 241.919983 627.78241 C 241.919983 647.112366 257.589996 662.78241 276.920013 662.78241 C 296.249969 662.78241 311.919983 647.112366 311.919983 627.78241 Z"/>
            <path id="#path_env" fill="#027aff" stroke="none" opacity="0" d="M 474.919983 635.78241 C 474.919983 616.452454 459.249969 600.78241 439.920013 600.78241 C 420.589996 600.78241 404.919983 616.452454 404.919983 635.78241 C 404.919983 655.112366 420.589996 670.78241 439.920013 670.78241 C 459.249969 670.78241 474.919983 655.112366 474.919983 635.78241 Z"/>
            <path id="#path_hs" fill="#027aff" stroke="none" opacity="0" d="M 593.919983 574.78241 C 593.919983 555.452454 578.249939 539.78241 558.920044 539.78241 C 539.590027 539.78241 523.919983 555.452454 523.919983 574.78241 C 523.919983 594.112366 539.590027 609.78241 558.920044 609.78241 C 578.249939 609.78241 593.919983 594.112366 593.919983 574.78241 Z"/>
            <path id="#path_em" fill="#027aff" stroke="none" opacity="0" d="M 109.919983 467.78241 C 109.919983 448.452454 94.249954 432.78241 74.920013 432.78241 C 55.590012 432.78241 39.919983 448.452454 39.919983 467.78241 C 39.919983 487.112366 55.590012 502.78241 74.920013 502.78241 C 94.249954 502.78241 109.919983 487.112366 109.919983 467.78241 Z"/>
        </svg>
    
    
</div>
</body>
</html>

我根据名称为每个图形创建了 CSS 属性,并期望每个图形都呈现一个半透明的圆圈;但在列表中的第一个图形中,path_cm 的行为符合预期。

python
  • 1 1 个回答
  • 36 Views

1 个回答

  • Voted
  1. Best Answer
    willeM_ Van Onsem
    2024-09-27T07:30:02+08:002024-09-27T07:30:02+08:00

    [ mdn -doc]不应以井号 ( ) 作为前缀,该部分表示“id 为 的元素,而不是”,因此:id="…" ##foofoo#foo

    <svg width="720" height="688" viewBox="0 0 720 688" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
        (png data)
        <a href='{% url 'introduction' %}'>
        <path id="path_cm" fill="#027aff" stroke="none" opacity="0" d="M 707.76001 330.686188 C 707.76001 311.409363 692.125793 295.78241 672.840027 295.78241 C 653.554199 295.78241 637.919983 311.409363 637.919983 330.686188 C 637.919983 349.963013 653.554199 365.589966 672.840027 365.589966 C 692.125793 365.589966 707.76001 349.963013 707.76001 330.686188 Z"/>
        </a>
        <a href='{% url 'introduction' %}'>
        <path id="path_rm" fill="#027aff" stroke="none" opacity="0" d="M 676.919983 195.78241 C 676.919983 176.452454 661.249939 160.78241 641.920044 160.78241 C 622.590027 160.78241 606.919983 176.452454 606.919983 195.78241 C 606.919983 215.112366 622.590027 230.78241 641.920044 230.78241 C 661.249939 230.78241 676.919983 215.112366 676.919983 195.78241 Z"/>
        </a>
        <path id="path_is" fill="#027aff" stroke="none" opacity="0" d="M 532.919983 52.78241 C 532.919983 33.452454 517.249939 17.78241 497.920013 17.78241 C 478.589996 17.78241 462.919983 33.452454 462.919983 52.78241 C 462.919983 72.112366 478.589996 87.78241 497.920013 87.78241 C 517.249939 87.78241 532.919983 72.112366 532.919983 52.78241 Z"/>
        <path id="path_bc" fill="#027aff" stroke="none" opacity="0" d="M 707.919983 330.78241 C 707.919983 311.452454 692.249939 295.78241 672.920044 295.78241 C 653.590027 295.78241 637.919983 311.452454 637.919983 330.78241 C 637.919983 350.112366 653.590027 365.78241 672.920044 365.78241 C 692.249939 365.78241 707.919983 350.112366 707.919983 330.78241 Z"/>
        <path id="path_hr" fill="#027aff" stroke="none" opacity="0" d="M 82.919983 332.78241 C 82.919983 313.452454 67.249954 297.78241 47.920013 297.78241 C 28.59001 297.78241 12.919983 313.452454 12.919983 332.78241 C 12.919983 352.112366 28.59001 367.78241 47.920013 367.78241 C 67.249954 367.78241 82.919983 352.112366 82.919983 332.78241 Z"/>
        <path id="path_ict" fill="#027aff" stroke="none" opacity="0" d="M 676.919983 467.78241 C 676.919983 448.452454 661.249939 432.78241 641.920044 432.78241 C 622.590027 432.78241 606.919983 448.452454 606.919983 467.78241 C 606.919983 487.112366 622.590027 502.78241 641.920044 502.78241 C 661.249939 502.78241 676.919983 487.112366 676.919983 467.78241 Z"/>
        <path id="path_sc" fill="#027aff" stroke="none" opacity="0" d="M 195.919983 570.78241 C 195.919983 551.452454 180.249954 535.78241 160.920013 535.78241 C 141.590012 535.78241 125.919983 551.452454 125.919983 570.78241 C 125.919983 590.112366 141.590012 605.78241 160.920013 605.78241 C 180.249954 605.78241 195.919983 590.112366 195.919983 570.78241 Z"/>
        <path id="path_fa" fill="#027aff" stroke="none" opacity="0" d="M 311.919983 627.78241 C 311.919983 608.452454 296.249969 592.78241 276.920013 592.78241 C 257.589996 592.78241 241.919983 608.452454 241.919983 627.78241 C 241.919983 647.112366 257.589996 662.78241 276.920013 662.78241 C 296.249969 662.78241 311.919983 647.112366 311.919983 627.78241 Z"/>
        <path id="path_env" fill="#027aff" stroke="none" opacity="0" d="M 474.919983 635.78241 C 474.919983 616.452454 459.249969 600.78241 439.920013 600.78241 C 420.589996 600.78241 404.919983 616.452454 404.919983 635.78241 C 404.919983 655.112366 420.589996 670.78241 439.920013 670.78241 C 459.249969 670.78241 474.919983 655.112366 474.919983 635.78241 Z"/>
        <path id="path_hs" fill="#027aff" stroke="none" opacity="0" d="M 593.919983 574.78241 C 593.919983 555.452454 578.249939 539.78241 558.920044 539.78241 C 539.590027 539.78241 523.919983 555.452454 523.919983 574.78241 C 523.919983 594.112366 539.590027 609.78241 558.920044 609.78241 C 578.249939 609.78241 593.919983 594.112366 593.919983 574.78241 Z"/>
        <path id="path_em" fill="#027aff" stroke="none" opacity="0" d="M 109.919983 467.78241 C 109.919983 448.452454 94.249954 432.78241 74.920013 432.78241 C 55.590012 432.78241 39.919983 448.452454 39.919983 467.78241 C 39.919983 487.112366 55.590012 502.78241 74.920013 502.78241 C 94.249954 502.78241 109.919983 487.112366 109.919983 467.78241 Z"/>
    </svg>

    您还忘记关闭<a>标签了,因此</a>不要使用<a>。

    • 1

相关问题

  • 如何将 for 循环拆分为 3 个单独的数据框?

  • 如何检查 Pandas DataFrame 中的所有浮点列是否近似相等或接近

  • “load_dataset”如何工作,因为它没有检测示例文件?

  • 为什么 pandas.eval() 字符串比较返回 False

  • Python tkinter/ ttkboostrap dateentry 在只读状态下不起作用

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    Vue 3:创建时出错“预期标识符但发现‘导入’”[重复]

    • 1 个回答
  • Marko Smith

    为什么这个简单而小的 Java 代码在所有 Graal JVM 上的运行速度都快 30 倍,但在任何 Oracle JVM 上却不行?

    • 1 个回答
  • Marko Smith

    具有指定基础类型但没有枚举器的“枚举类”的用途是什么?

    • 1 个回答
  • Marko Smith

    如何修复未手动导入的模块的 MODULE_NOT_FOUND 错误?

    • 6 个回答
  • Marko Smith

    `(表达式,左值) = 右值` 在 C 或 C++ 中是有效的赋值吗?为什么有些编译器会接受/拒绝它?

    • 3 个回答
  • Marko Smith

    何时应使用 std::inplace_vector 而不是 std::vector?

    • 3 个回答
  • Marko Smith

    在 C++ 中,一个不执行任何操作的空程序需要 204KB 的堆,但在 C 中则不需要

    • 1 个回答
  • Marko Smith

    PowerBI 目前与 BigQuery 不兼容:Simba 驱动程序与 Windows 更新有关

    • 2 个回答
  • Marko Smith

    AdMob:MobileAds.initialize() - 对于某些设备,“java.lang.Integer 无法转换为 java.lang.String”

    • 1 个回答
  • Marko Smith

    我正在尝试仅使用海龟随机和数学模块来制作吃豆人游戏

    • 1 个回答
  • Martin Hope
    Aleksandr Dubinsky 为什么 InetAddress 上的 switch 模式匹配会失败,并出现“未涵盖所有可能的输入值”? 2024-12-23 06:56:21 +0800 CST
  • Martin Hope
    Phillip Borge 为什么这个简单而小的 Java 代码在所有 Graal JVM 上的运行速度都快 30 倍,但在任何 Oracle JVM 上却不行? 2024-12-12 20:46:46 +0800 CST
  • Martin Hope
    Oodini 具有指定基础类型但没有枚举器的“枚举类”的用途是什么? 2024-12-12 06:27:11 +0800 CST
  • Martin Hope
    sleeptightAnsiC `(表达式,左值) = 右值` 在 C 或 C++ 中是有效的赋值吗?为什么有些编译器会接受/拒绝它? 2024-11-09 07:18:53 +0800 CST
  • Martin Hope
    The Mad Gamer 何时应使用 std::inplace_vector 而不是 std::vector? 2024-10-29 23:01:00 +0800 CST
  • Martin Hope
    Chad Feller 在 5.2 版中,bash 条件语句中的 [[ .. ]] 中的分号现在是可选的吗? 2024-10-21 05:50:33 +0800 CST
  • Martin Hope
    Wrench 为什么双破折号 (--) 会导致此 MariaDB 子句评估为 true? 2024-05-05 13:37:20 +0800 CST
  • Martin Hope
    Waket Zheng 为什么 `dict(id=1, **{'id': 2})` 有时会引发 `KeyError: 'id'` 而不是 TypeError? 2024-05-04 14:19:19 +0800 CST
  • Martin Hope
    user924 AdMob:MobileAds.initialize() - 对于某些设备,“java.lang.Integer 无法转换为 java.lang.String” 2024-03-20 03:12:31 +0800 CST
  • Martin Hope
    MarkB 为什么 GCC 生成有条件执行 SIMD 实现的代码? 2024-02-17 06:17:14 +0800 CST

热门标签

python javascript c++ c# java typescript sql reactjs html

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve