- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我有时发现根据 bottom
、top
、left
和 right 给出元素的大小很方便
属性,而不是使用 width
和 height
。例如,这是此处接受的答案:
CSS 100% height with padding/margin
但是,由于某些原因,这不适用于 svg
元素。我已经使用最新的稳定版 Firefox 和 Chrome 尝试了以下示例。 svg
元素莫名其妙地想要采用 300x150 的大小:
为什么?
最佳答案
虽然规范中没有直接提及(至少在我看来是这样)<svg>
is considered作为replaced element (与 <div>
不同,它是一个不可替换的 block 级元素)。
对于绝对定位的替换元素,如果 top
的值/bottom
一旦您为 top
设置值,就会受到过度约束, bottom
会被忽略。这适用于 left
/right
属性也是如此。
10.3 Calculating widths and margins / 10.3.8 Absolutely positioned, replaced elements
- If at this point the values are over-constrained, ignore the value for either 'left' (in case the 'direction' property of the containing block is 'rtl') or 'right' (in case 'direction' is 'ltr') and solve for that value.
10.6 Calculating heights and margins / 10.6.5 Absolutely positioned, replaced elements
- If at this point the values are over-constrained, ignore the value for 'bottom' and solve for that value.
因此绝对定位 <svg>
元素将相对于 top
定位和 left
偏移量。
关于html - 为什么 svg 元素不遵守 CSS 'bottom'、 'top'、 'left'、 'right' 属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26185037/
根据 PEP 257命令行脚本的文档字符串应该是它的用法信息: The docstring of a script (a stand-alone program) should be usable a
我有一个使用 exit 的批处理文件命令返回退出代码。 在某些情况下,该批处理文件可以从命令行以交互方式调用,或者在其他情况下,可以使用 Exec 作为 MSBuild 项目的一部分运行。任务。 如果
以下内容使 nginx 不传递到 PHP-FPM fastcgi 服务器,因为我创建了一个位置 block : location = /test.php { auth_basic "Nope.
java bean 命名标准是否有可能有助于实现封装? 访问修饰符不是有助于封装吗? 最佳答案 没有。命名标准不会做、开放或限制任何事情。对于封装,您当然需要访问修饰符。最好是两者都使用。即使您有一段
在 mysql Ver 14.14 Distrib 5.1.66 上,对于未知的 linux-gnu (x86_64),存在未遵守/遵守 MySQL 外键约束的问题。 数据库/表结构从未被修改过,又名
收到一封来自 Apple 的关于应用更新截止日期的电子邮件 更多信息 - link 作为开发人员需要在 iOS13 SDK 的代码库中进行哪些更改我已经更改了目标并构建了应用程序,除此之外我们还必须实
我有一个生成 IAsyncEnumerable 的异步迭代器方法(数字流),每 200 毫秒一个数字。此方法的调用者使用流,但希望在 1000 毫秒后停止枚举。所以一个CancellationToke
我是 Swift 开发的新手,在尝试做一些教程时遇到了困难(我知道,它们是一步一步的,但显然我一定在某个地方搞砸了,现在我无法弄清楚为什么它不起作用。我不太擅长调试,并且对该语言的基础缺乏扎实的理解。
有点愚蠢的问题。例如我读过,在 C11 中添加了对线程的支持。然后,例如我的STM32F4的GCC编译器说,它支持C11标准。那么,这是否意味着现在没有操作系统我将获得线程支持???但这怎么可能呢?
我的网站使用 zurb Foundation。它已经得到了自己的验证。这是a link到文档。 我使用以下代码来验证并提交我的表单数据。 $('#myForm').on('valid', functi
我知道 ansible 支持这种形式的模板中的循环: {% for host in groups['all'] %} "{{ host }}"{% if not loop.last %},{% e
我很困惑 time-based cache policies使用 HttpWebRequest 时工作。 我正在调用 WebAPI 的 GET 方法,该方法返回 JSON 内容以及类似于以下内容的 C
我正在使用 zurb foundation 5 和 abide js 检查我的表单。我必须检查 DATE1 是否早于或等于 DATE2 如何使用 abidejs 检查它是否有效? 最佳答案 简短的回答
我有一个非常简单的 javascript 构造函数,如下所示: function DisplayedTableData() { this.rowData = []; } SonarQube 提
我有一个 div 嵌套在两个 div 中。最外层和最内层的 div 都有固定的宽度。我想将最外层的 div's width 设置为 0,这样它的所有子项也都将为 0,或者至少不可见。 但是当我将最外面
我们使用 GSLB 进行地理分布和负载平衡。每个服务都分配了一个固定的域名。通过一些 DNS 魔术,域名被解析为最接近负载最少的服务器的 IP。为了使负载均衡发挥作用,应用服务器需要遵守来自 DNS
我正在编写一个向 REST API 服务发出频繁请求的 Android 应用程序。此服务的硬请求限制为每秒 2 个请求,之后它将返回 HTTP 503,没有其他信息。我想成为一名优秀的开发人员并限制我
ScalaTest 的输出是彩色的以区分不同的状态,但这些最终作为控制代码和 [34m Annoying garbage 有没有办法说服 Eclipse 控制台尊重或忽略这些序列,或者插入一个 Vie
我对 Node.js 比较陌生,我试图通过编写一个简单的模块来更熟悉它。该模块的目的是获取 ID、抓取网站并返回包含数据的字典数组。 网站上的数据分散在各个页面上,而每个页面都通过 URI 中的不同索
我正在通过 gradle/maven 使用 slf4j-android 1.6.1-RC1,当我在模拟器中运行应用程序时,当我在 Android Studio 0.3.5 下调用 Log.debug
我是一名优秀的程序员,十分优秀!