html - Webkit/Blink 浏览器不遵守图例标签上的显示样式

标签 html css webkit blink

Webkit 浏览器中的 Legend 标签似乎不接受除 blocknone 之外的任何样式用于 CSS display属性:

这是 HTML

<legend>I should display as an inline block</legend>
<div>I should be on the same line</div>

这是 CSS(将 blocknone 以外的任何内容作为 display 样式)

legend {
    display: inline-block;
    background: black;
    color: white;
    -webkit-margin-top-collapse: separate;
}

div {
    display: inline-block;
    background: blue;
    color: white;
}

如你can see in this fiddle , legend 标签将始终被设置为 block 的样式。

enter image description here

您还会看到,尽管我应用了 -webkit-margin-top-collapse: separatewhich lets one apply margins to legend tags in webkit despite a quirk , 问题依旧。

我认为这是一个错误,尽管它没有出现在 list of bugs when searching for legend 中, 但有人知道如何规避它吗?

最佳答案

我能够让图例和 div 与以下 CSS 并排显示。

legend {
    background: black;
    color: white;
    float:left;
}
div {
    display: inline;
    background: blue;
    color: white;
}

http://jsfiddle.net/vhNbd/4/

关于html - Webkit/Blink 浏览器不遵守图例标签上的显示样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16523434/

相关文章:

html - 如何为页面顶部和底部之间的div设置背景图像?

css - 单击链接时 Internet Explorer 7 iframe 正在移动

javascript - 为什么我的 scrapy 下载器中间件无法正确渲染 javascript?

html - iOS7 webkit 上的 Span 分词

javascript - jQuery/javascript 和 WebKit 的 float 问题

html - 将一些字段从表单向右移动

php - <form> 标签在用 php 创建时不显示

java - 在 Selenium Test Automation 中使用符号定义 Css Selector 或不使用符号之间的性能优势?

html - 固定页面滚动

html - 如何使用 css nth-child(-n+3) 仅显示列表中的前三个图像