为什么线条在我的SVG元素中没有出现在我的圈子中

粉红猫

所以我想打个钟,正如您在下面的程序中看到的那样,线条没有出现在圆圈上,也找不到它们。请帮我,我不知道原因。这是我第一次制作SVG绘图,我永远也不会认为这会很难。

的HTML

<div class="container">
    <div class="frame">
        <svg viewBox="0 0 40 40">
            <circle cx="20" cy="20" r="19" class="circle"/> 
            <g class="numbers">
                <line x1="0" y1="0" x2="200" y2="200" class="one"/>
                <line x1="0" y1="0" x2="200" y2="200" class="two"/>
                <line x1="0" y1="0" x2="200" y2="200" class="three"/>
                <line x1="0" y1="0" x2="200" y2="200" class="four"/>
                <line x1="0" y1="0" x2="200" y2="200" class="five"/>
                <line x1="0" y1="0" x2="200" y2="200" class="six"/>
                <line x1="0" y1="0" x2="200" y2="200" class="seven"/>
                <line x1="0" y1="0" x2="200" y2="200" class="eight"/>
                <line x1="0" y1="0" x2="200" y2="200" class="nine"/>
                <line x1="0" y1="0" x2="200" y2="200" class="ten"/>
                <line x1="0" y1="0" x2="200" y2="200" class="eleven"/>
                <line x1="0" y1="0" x2="200" y2="200" class="twelve" />
            </g>
        </svg>
        
    </div>
    
</div>

的CSS

    body{
    background-color: darksalmon;
    margin: 0%;
    padding: 0%;
}
svg{
    height: 400px;
    
}
line{
    left : -280px;
    top : -187px;
    height: 10px;

}
.circle{
    float: left;
    position: relative;
    height: 400px;
    fill:thistle;
    stroke: black;
    stroke-width: 1;
    stroke-linecap: round ;
    z-index: 2;
}
运行脚本

如果线条没有笔触,则不会出现。您需要将类似的内容stroke: black应用于CSS中的行。

检查以下代码段:

body {
  background-color: darksalmon;
  margin: 0%;
  padding: 0%;
}

svg {
  height: 400px;
}

line {
  left: -280px;
  top: -187px;
  height: 10px;
  stroke: black;
}

.circle {
  float: left;
  position: relative;
  height: 400px;
  fill: thistle;
  stroke: black;
  stroke-width: 1;
  stroke-linecap: round;
  z-index: 2;
}
<div class="container">
  <div class="frame">
    <svg viewBox="0 0 40 40">
            <circle cx="20" cy="20" r="19" class="circle"/> 
            <g class="numbers">
                <line x1="0" y1="0" x2="200" y2="200" class="one"/>
                <line x1="0" y1="0" x2="200" y2="200" class="two"/>
                <line x1="0" y1="0" x2="200" y2="200" class="three"/>
                <line x1="0" y1="0" x2="200" y2="200" class="four"/>
                <line x1="0" y1="0" x2="200" y2="200" class="five"/>
                <line x1="0" y1="0" x2="200" y2="200" class="six"/>
                <line x1="0" y1="0" x2="200" y2="200" class="seven"/>
                <line x1="0" y1="0" x2="200" y2="200" class="eight"/>
                <line x1="0" y1="0" x2="200" y2="200" class="nine"/>
                <line x1="0" y1="0" x2="200" y2="200" class="ten"/>
                <line x1="0" y1="0" x2="200" y2="200" class="eleven"/>
                
                <line x1="20" y1="0" x2="20" y2="200" class="twelve" />
            </g>
        </svg>

  </div>

</div>

注意:在您的代码中,看起来只有一行可见,这是因为所有行都具有相同的起点和终点。我更改了其中一行的数字,以证明这不是代码的问题。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

为什么我的 vtt 字幕没有出现在我的 html5 视频中?

为什么我的json没有出现在我的参数中?

在R中,为什么变量名称以'。'开头 没有出现在我的环境中?

为什么我的log4j消息没有出现在日志文件中?

为什么我的vue.app没有出现在部署版本中?

为什么我的视图没有出现在angular-ui-router中?

为什么我的文本没有出现在微调器中的图像视图中?

为什么我的用户名没有出现在 TextView 中?

为什么我的JFrame没有出现在单元测试中?

为什么我的Swift struct属性没有出现在框架中?

为什么我的Laravel Eloquent访问器没有出现在响应中?

为什么我的客户端IP地址没有出现在netstat输出中?

为什么我的图片几乎没有突然出现在浏览器中?

为什么我的按钮没有出现在pygame中?

为什么我的 QLabel 小部件没有出现在这个线程中?

为什么我的角落小部件没有出现在QTabWidget中?

为什么我的图片没有出现在“更换壁纸”窗口的“图片”部分中?

为什么某些 css 属性没有出现在我的母版页中?

为什么我的图像没有出现在模态中?代码点火器

为什么我的 CSS 边框没有出现在 JavaFX gui 中?

为什么这个元素没有出现在 iPhone 的所有浏览器中?

尝试集成 2 个 OpenGL 程序。我的圈子没有按照我想要的方式出现在我的其他程序中

为什么出现在我的数据中?

为什么图片没有出现在背景中

为什么我的图标和启动屏幕没有出现在Phonegap Android应用程序中?

为什么我的自定义启动器没有出现在破折号中?

为什么我的Windows应用商店(Metro)应用程序没有出现在共享窗格中?

QRectF没有出现在我的QGraphicsScene中

Entry() 没有出现在我的程序中