- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
粉红色/中间矩形可见。顶部和底部不是,它们的样式已移至外部 CSS 中的类。检查元素在顶部/最右侧显示 1x1 图像? svg 区域。我不确定为什么在外部 CSS 中使用样式属性会导致矩形无法按预期呈现。请解释。
.countLegend p {
margin: 0em;
line-height: 1;
}
.legendTotal {
width:1.3em;
height:0.8em;
fill: rgb(135, 206, 250);
}
.legendRejected {
width:1.3em;
height:0.8em;
fill: rgb(197, 132, 240);
}
.legendInternalRejected {
width:1.3em;
height:0.8em;
fill: rgb(220, 20, 60);
}
.legendKey {
height: 1em;
width: 2em;
}
<div class="countLegend">
<p>
<svg class="legendKey">
<rect y="0.2em" x="0.5em" class="legendTotal"></rect>
</svg>
Count
<span id="spnTotalTrans" class="legendValue">10,250</span>
</p>
<p>
<svg class="legendKey">
<rect y="0.2em" x="0.5em" width="1.3em" height="0.8em" style="fill: rgb(197, 132, 240);"></rect>
</svg>
Rejections Total
<span id="spnRejectedTrans" class="legendValue">86,335</span>
</p>
<p>
<svg class="legendKey">
<rect y="0.2em" x="0.5em"></rect>
</svg>
Rejections Internal
<span id="spnIntRejectedTrans" class="legendValue">86,335</span>
</p>
</div>
最佳答案
这里的问题是您使用的是 SVG 元素,它需要 height
和 width
attributes,而不是 CSS properties。不同之处在于,作为 SVG 元素的属性,它们不能移至 CSS。
根据SVG Spec ,对于 height
和 width
属性:
A value of 0 disables rendering of the element.
如您所见,如果将属性编辑回 SVG 元素,fill
属性 is still being applied ,所以 CSS 实际上并没有被忽略。
.countLegend p {
margin: 0em;
line-height: 1;
}
.legendTotal {
fill: rgb(135, 206, 250);
}
.legendRejected {
width:1.3em;
height:0.8em;
fill: rgb(197, 132, 240);
}
.legendInternalRejected {
width:1.3em;
height:0.8em;
fill: rgb(220, 20, 60);
}
.legendKey {
height: 1em;
width: 2em;
}
<div class="countLegend">
<p>
<svg class="legendKey">
<rect y="0.2em" x="0.5em" height="0.8em" width="1.3em" class="legendTotal"></rect>
</svg>
Count
<span id="spnTotalTrans" class="legendValue">10,250</span>
</p>
<p>
<svg class="legendKey">
<rect y="0.2em" x="0.5em" width="1.3em" height="0.8em" style="fill: rgb(197, 132, 240);"></rect>
</svg>
Rejections Total
<span id="spnRejectedTrans" class="legendValue">86,335</span>
</p>
<p>
<svg class="legendKey">
<rect y="0.2em" x="0.5em"></rect>
</svg>
Rejections Internal
<span id="spnIntRejectedTrans" class="legendValue">86,335</span>
</p>
</div>
关于html - 为什么将样式移至 CSS 后矩形看起来不一样(或根本不一样)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29013996/
我有一个类似于下面给出的 for 循环。 for(int i=0; i<10; i++) { boolean condition = checkCondition(); /* line 3
我有一个循环,处理文件夹的每个文件。万一文件损坏而无法打开,我想: -向用户显示错误消息 -停止执行剩余的代码 -循环到下一个文件 问题是,如果无法在循环开始时打开文件,则仍有许多代码将要执行,这将引
我知道我可以将键绑定(bind)到“移至行首”,但这会忽略缩进。 我正在寻找的是移动到一行文本的开头,以便: CGRect example = CGRectMake(view.frame.origin
我有一个用户请求,我正在努力满足,我能想到的最简单的解释方法是使用图片说明: 本质上,用户正在输入大量日期。而不是输入 MM [反斜杠(或右箭头)] DD [反斜杠] YYYY [反斜杠] 等 ...
我想打开一个 pdf 文件并移动到 C++ 和 qt 程序中的特定书签。根据我的研究,我们可以使用 URL 和命令提示符转到书签。使用 URL 具有特殊格式,如:fileName.pdf#page=3
我正在尝试移至 PHP 记录集中的下一条记录,但遇到了一些问题。 这是我的页面顶部用于设置我的记录集的内容。 $result = mysqli_query($con,"SELECT * FROM
我已经制作了一个在 java 类中运行良好的程序..但是当我将我的代码移动到 servlet 时它并没有像预期的那样运行程序创建一些文件写入它们,然后再从中读取。问题是当我将代码移动到 servlet
我遇到了在 64 位 Windows 上运行的 32 位旧版应用程序的问题。有问题的应用程序使用 CreateFileMapping 创建共享内存。当它在 64 位 Windows 上运行时,任何从另
我们计划迁移到 TFS。虽然我讨厌它,但由于各种原因我们不得不这样做。 我们有开发、暂存和实时分支。我们是否将每个分支的源代码作为单独的文件夹移至 TFS,并稍后将其转换为分支? 是否可以保留历史记录
有人可以为我提供一些关于如何将此代码移植到 renderscript 以获得更好性能的指南吗? private void someMethod() { for (int i = 0; i < src
我有一个非常大的稀疏矩阵,我想将其发送到 Java 函数。我写了一个java代码来完成这个任务,但是它很慢,所以我正在寻找更好的解决方案。我从 R 3 数组发送如下 TMPmat <- as(mySp
我正在移动一张旧的 Mantis table ,上面有 varchar(64) category_id 列添加到新的 Mantis 表中,该表的 int(10) category_id 列。 简化后的
将中等流量网站的所有读取查询从 mysql 移至 solr 是否值得?我们已经使用 solr 作为我们网站的搜索引擎。我们每 24 小时将整个记录加载到 solr 中一次,然后每 20 分钟运行部分导
我在 MySQL (innodb) 中有三个表(X、Y 和 Z)。 X是一个超过1000万行的表,并且以Y为主键作为外键。同样,Z是超过3000万行的表,并且以Y为主键作为外键。 现在的问题是 Y 的
我在没有编程经验的情况下开始探索 Swift2。 我有以下代码在 Playgrounds 中运行良好,使用快速 View 和内联 View 方法。 如何将它与 Storyboard中的实际标签相关联?
在CSAPP练习3.4中 src_t v; dest_t *p; *p = (dest_t) v; 当src_t为char且dest_t为int时,答案为 movsbl %al, (%edx) (v
我正在测试我正在构建的 Webjob 的 Poison 消息处理。 一切似乎都按预期进行,除了一件奇怪的事情: 当一条消息被移动到“-poison”队列时,它的幽灵似乎仍然隐藏在主作业队列中(不可见)
我是 Android/Java 新手,所以请耐心等待。 我从 LoginActivity > onCreate 移动了代码进入我创建的 fragment FragmentLogin方法onCreate
这只是我真实代码的演示,但问题是一样的。有没有其他或更好的解决方案。为什么 animate() 方法不起作用...... $('document').ready(function() { $('p
我有一个小工件。 HTML: X CSS: #it { background: blue; width: 40px; text-align: center; color
我是一名优秀的程序员,十分优秀!