html - 跨度上的内联 div 不覆盖全文高度

标签 html css

我有这个 HTML:

<div style="border:1.00px solid #000000;display:inline;">
<span style="font-family:Arial;font-size:20pt;">this is some text</span>
</div> 

我想应用边框来仅覆盖文本。边框不覆盖跨度的整个高度。这是什么原因?

编辑:

<div>
<div style="border:1.00px solid #000000;display:inline-block;">
<span style="font-family:Arial;font-size:20pt;">this is some text this is some text this is some this is some text</span>
</div>
<span style="font-family:Arial;font-size:20pt;">this is some text</span>
</div>

我将“inline”更改为“inline-block”。在那种情况下,跨越多行且具有边框的行实际上不仅覆盖了文本。我正在尝试的是,如果整个文本的只有一部分有边框。边框盖是整条线。这是正常现象还是我可以解决这个问题?

I was expecting this output when using inline-block.

最佳答案

Use "display: inline-block;" instead of 'display:inline'.

关于html - 跨度上的内联 div 不覆盖全文高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35692671/

相关文章:

javascript - JQuery 函数在其他函数执行后不起作用

javascript - 如何使用 POST 重定向时通过 onclick 和 POST 数据获取

html - 如何减少 Shiny 的交互式 rmarkdown 利润?

html - Bootstrap 折叠菜单不显示样式

html - 如何让分页符显示在打印窗口中的 div 之后?

javascript - 在不影响按钮的情况下调用某些按钮上的函数 onclick 单个 onclick 函数(所有已准备好分配给按钮)-JavaScript

jquery - 如何在 <br> 之后获取文本?

jquery - 向下滚动时如何构建 float 菜单栏

html - Telerik RadButton 更改选项卡/焦点/事件上的文本颜色

html - 需要在中心显示所有 3 个部分