gpt4 book ai didi

html - HTML 文件的输出不显示 C 生成代码中的图像

转载 作者:行者123 更新时间:2023-11-30 15:15:48 27 4
gpt4 key购买 nike

所以我编写了一个 C 程序,它输出一个 HTML 文件,该文件应该打印出 1000 个 SVG 圆形、矩形和椭圆。当我在浏览器中运行 html 文件时,它不会打印任何形状。这是代码的一部分(开头和结尾,因为它有一千行)

    <!DOCTYPE html>
<html>
<head>
<title>CSC 111 Fall 2015 - Assignment 5 Part 2</title>
</head>
<body>
CSC 111 Art: <br /><svg width="800px" height="800px">
<g transform="translate(0 800)">
<g transform="scale(1 -1)">
<rect x="0" y="0" width="800" height="800" style="fill: none; stroke-width: 5; stroke:rgb(255,255,255); stroke-opacity:1.0;" />
<circle cx="63" cy="373" r="58" style="fill:rgb(170,190,91); fill- opacity:0.0"/>
<rect x="265" y="271" width="242" height="325" style="fill:rgb(90,23,196); fill-opacity:0.0"/>
<rect x="356" y="179" width="42" height="314" style="fill:rgb(91,127,53); fill-opacity:0.0"/>
<circle cx="26" cy="327" r="79" style="fill:rgb(151,136,102); fill-opacity:0.0"/>
<rect x="202" y="280" width="127" height="398" style="fill:rgb(85,47,254); fill-opacity:0.0"/>
<circle cx="298" cy="347" r="38" style="fill:rgb(33,95,51); fill-opacity:0.0"/>
<circle cx="112" cy="266" r="19" style="fill:rgb(106,251,120); fill-opacity:0.0"/>
<rect x="275" y="275" width="140" height="37" style="fill:rgb(187,37,21); fill-opacity:0.0"/>
<circle cx="395" cy="11" r="93" style="fill:rgb(139,247,93); fill-opacity:0.0"/>
<rect x="226" y="93" width="102" height="204" style="fill:rgb(140,222,148); fill-opacity:0.0"/>
<circle cx="9" cy="118" r="72" style="fill:rgb(232,14,183); fill-opacity:0.0"/>
<rect x="242" y="148" width="140" height="254" style="fill:rgb(167,132,206); fill-opacity:0.0"/>
<rect x="375" y="397" width="138" height="295" style="fill:rgb(179,175,20); fill-opacity:0.0"/>
</g></g>
</svg>
</body>
</html>

任何人都可以指出代码中的问题,导致其无法在浏览器中运行吗?

最佳答案

您发布的代码片段在浏览器中运行得很好,但我直接看到两个问题。

<小时/>

首先是颜色选择,尽管这可能根本不是问题,具体取决于您的浏览器配色方案。

如果您的浏览器和我的一样具有白色背景色,您将永远不会看到用 rgb(255,255,255) 指定的对象,只是因为它们将被渲染为白底白字。

<小时/>

第二(这是真正的问题),你永远不会看到带有 fill-opacity:0.0 的对象因为它们是完全透明的(实际上是不可见的)。

如果您只想要实心不透明形状,则应该使用 1.0当然,您可以选择介于 0 之间的值。和1不同级别的不透明度。

关于html - HTML 文件的输出不显示 C 生成代码中的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33380503/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com