html - 有序列表中的 float 跨度

标签 html css

我试图在 li 中 float 两个 span。左跨度将有我的标签,在右跨度内我将构建一个具有嵌套跨度的图形。我有基本结构,但 chrome 将数字放在左侧跨度的末尾。我该如何解决这个问题?

HTML

<ol class="matchGraph">
                    <li>
                        <span class="leftLabel">Texas</span>
                        <span class="rightMatch"><span class="barchart" style="width: 67%"></span><span class="barchartNumber">67%</span></span>
                    </li>
</ol>

CSS

父CSS

.inner .textBlock ul, .inner .textBlock ol { margin: 0;padding-left: 20px;}

元素CSS

ol.matchGraph { width: auto;margin: 0;}
ol.matchGraph li {margin-bottom: 5px;}
ol.matchGraph li .leftLabel {float: left; width: 60%;display: block;}
ol.matchGraph li .rightMatch { float: right;width: 38%;display: block;}

这是来自 FF、Chrome 和 IE 的显示

enter image description here

最佳答案

您只需要在 items.css 修改您的 css。

ol.matchGraph { width: auto; margin: 0;}
ol.matchGraph li {margin-bottom: 5px;}
ol.matchGraph li .leftLabel {width: 60%; display: inline-block;}
ol.matchGraph li .rightMatch {width: 38%; display: inline-block;}

关于html - 有序列表中的 float 跨度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27116039/

相关文章:

python - Web Scraping Python 访问表数据

javascript - 目标 ="_blank"与 window.open

css - 在 SASS 中嵌套对象

html - 选项卡式布局中的并排 div 在移动浏览器上重叠

css - 构建产品不显示字体 - 基本的 webpack init

html - Bootstrap CSS 专栏

javascript - 使用其 url 生成 youtube 视频的嵌入代码

javascript - 在不读/写数据库的情况下更新表元素

html - 悬停在第 n 个 child 上的问题

html - 试图理解 float 和文本