首页 \ 问答 \ HTML浮点数元素顺序(HTML float right element order)

HTML浮点数元素顺序(HTML float right element order)

如果我有三个元素在右边,为什么顺序是跟随的(见jsfiddle)元素1是右边的第一个元素,当元素3实际上是最后一个元素时。

现在订单

[3] [2] [1]

但是html中的元素是这样的

[1] [2] [3]

为什么?

http://jsfiddle.net/A9Ap7/


If I have three elements flaoted to right, why order is following (see jsfiddle) element 1 is first element on right side, when element 3 is actually last element.

Order is now

[3] [2] [1]

But elements are in this order in html

[1] [2] [3]

Why?

http://jsfiddle.net/A9Ap7/


原文:https://stackoverflow.com/questions/8287265
更新时间:2022-01-18 07:01

最满意答案

我找到了决定。 级联样式表CSS 2.1 - 10.5表示百分比高度是根据生成的包含块的高度来计算的。 如果包含块的高度没有明确指定(即,它取决于内容高度),并且该元素没有被绝对定位,则该值计算为'auto'。 对于其包含块基于块容器元素的绝对定位元素,将根据该元素的填充框的宽度计算百分比。 这是从CSS1的变化,其中百分比宽度总是相对于父元素的内容框进行计算。

所以我必须使用SVG文件的标签对象中的风格position:absolute


I found decision. Cascading style sheets CSS 2.1 - 10.5 says the percentage height is calculated with respect to the height of the generated box's containing block. If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, the value computes to 'auto'. For absolutely positioned elements whose containing block is based on a block container element, the percentage is calculated with respect to the width of the padding box of that element. This is a change from CSS1, where the percentage width was always calculated with respect to the content box of the parent element.

So I have to use style position:absolute in tag object with SVG file.

相关问答

更多
  • 我找到了决定。 级联样式表CSS 2.1 - 10.5表示百分比高度是根据生成的包含块的高度来计算的。 如果包含块的高度没有明确指定(即,它取决于内容高度),并且该元素没有被绝对定位,则该值计算为'auto'。 对于其包含块基于块容器元素的绝对定位元素,将根据该元素的填充框的宽度计算百分比。 这是从CSS1的变化,其中百分比宽度总是相对于父元素的内容框进行计算。 所以我必须使用SVG文件的标签对象中的风格position:absolute 。 I found decision. Cascading styl ...
  • 你可以使用setViewBox() http://raphaeljs.com/reference.html#Paper.setViewBox 但是,如果将此用于缩放,将不再有1:1单位:像素比例。 You can use setViewBox() http://raphaeljs.com/reference.html#Paper.setViewBox However, if you use this for scaling there will no longer be a 1:1 unit:pixel s ...
  • 如果我使用指向SVG的图像标签,并且使用以下CSS,它似乎对我(至少在Firefox中)有效: - #container img { width: 100%; max-height: 100%; } 容器是一个灵活的div,它限制了SVG的大小(这可能是你的表格单元格)。 SVG正在填充容器的宽度,比例保持在pro中,但是如果容器变得太宽,则最大高度会踢入并限制SVG的高度,而不会拉伸。 It seems to work for me (at least in Firefox) if I ...
  • 我发现快速破解,用svg的文本替换svg以强制重绘。 $.fn.xml = function() { return (new XMLSerializer()).serializeToString(this[0]); }; $.fn.SVGRedraw = function() { return $(this.xml()).replaceAll(this); }; I found quick hack, to replace svg with text of the svg to forc ...
  • 您不能依赖于屏幕上X像素的内容在打印时将为X像素的事实。 您需要打印一些样本并测量打印的SVG以计算比例。 它在浏览器和打印机之间会有所不同。 首先将SVG设置为在屏幕上以1:1呈现。 为此,请设置width="496"和height="388"以匹配viewBox。 打印并测量已知尺寸。 比如一面墙。 因此,假设您的计划中的2米墙在打印时为53毫米。 然后你的真实长度到打印长度比例因子是 2m = 53mm printed worldToPrinterScaleFactor = 53 / 2000 要打 ...
  • 这可能有帮助。 我使用这个CSS来适应宽度和高度的背景图像,并相应地缩小到浏览器。 html { -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; position: relative; } 您可以将SVG设置为DIV并为其添加类,然后只需使用上面的CSS来缩放DIV的内容即可。 Related question ...
  • 如果您的受众使用的是带有HTML 5解析器的浏览器( 现在受到广泛支持 ),则您不需要直接在svg标记中使用任何xml内容。 您不需要对象或嵌入标记标记。 那时候那是老派。 你当然不需要iFrame。 另外,为了澄清一下,SVG本身与jQuery无关(实际上jquery与svg元素相比非常糟糕)。 只需确保您使用的是html5 doctype,并将其写成以下内容:
  • 问题是LaTeX生成的SVG适用于整个页面,它设置的viewBox代表页面。 要使页面中间的图表按比例缩放并适合您想要的任何大小,您需要更新viewBox以便它反映(仅)图表的边界框。 事实证明,使用的相应viewBox大致是: viewBox="134 174 489 168" 如果你将其设置为(并更新你的width和height ),你将得到一个行为符合你想要的SVG。
  • 尝试background-size: cover元素之前和之后。 Try background-size: cover for both before and after elements.
  • 您可以使用scale(x,y) transform命令来缩放元素。 标度1是正常大小,0.5是正常大小的一半,2是正常大小的双倍。 例如,将transform="scale(1, 2)"到标记中,以便水平缩放,垂直缩放两倍。 You can use the scale(x,y) transform command to scale an element. A scale of 1 is normal size, 0.5 is half normal size, and 2 is double normal ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)