【问题标题】:Bold Tags in HTML/CSSHTML/CSS 中的粗体标签
【发布时间】:2020-12-23 05:11:56
【问题描述】:

我使用在线转换器将文件从 PDF 转换为 HTML,目的是从 HTML 文档中提取粗体特征。但是,我在 HTML 脚本上找不到任何粗体标记(HTML 或 CSS),但是当我在 Web 浏览器上打开 HTML 文件时,粗体字符以粗体显示。

查看此示例 HTML 摘录以了解粗体功能

<div class="t m0 x3 h3 y9 ff2 fs0 fc0 sc0 ls11 ws0">1.<span class="ls0"> <span class="_ _1"> </span><span class="ls1">My Laptop</span> </span></div>

上面的HTML脚本输出**1. My Laptop**

这是一个非粗体特征的 HTML 摘录

<div class="t m0 x3 h4 y15 ff3 fs0 fc0 sc0 ls11 ws0">2<span class="ls0"> <span class="_ _2"> </span><span class="ls8">Laptops <span class="ls4">are</span></span> <span class="ls13">grea</span>t <span class="ls7">tools </span> <span class="lsd">in codi<span class="_ _3"></span>ng with<span class="_ _3"></span> the <span class="ls0">C<span class="ls1f">ommand </span>L</span>ine.  <span class="ls0"> </span></span></span></div>

上面的脚本打印 2. Laptops are great tools in coding with the Command Line

如您所见,它们都有很多相似的类标签。然而,这里有不同的标签:

(h3, h4), (y9, y15), (ff2, ff3)

这些是我从 HTML 文件的标题中得到的标签的描述

**h3:** .h3{height:29.275313px;} Looks like a tag for height
**h4:** .h4{height:28.940625px;} Looks like a tag for height

**y9:** .y9{bottom:891.946667pt;} Looks like a tag that measures the vertical position of the character on the HTML page
**y15:** .y15{bottom:655.928000px;} Looks like a tag that measures the vertical position of the character on the HTML page


**ff2:** .ff2{font-family:ff2;line-height:0.904297;font-style:normal;font-weight:normal;visibility:visible;} 
**ff3:** .ff3{font-family:ff3;line-height:0.895996;font-style:normal;font-weight:normal;visibility:visible;}

我主要使用 Python 编写代码,所以我是 HTML 和 CSS 的新手。我在网上搜索了在 HTML/CSS 文件上识别粗体标签的方法,我的研究将其缩小到三种方式:

- **font-weight: bold|bolder**

如上所示,标签 font-weight 对粗体和非粗体字符都显示正常

- **the &lt;b&gt; Element**

文件上没有 HTML 标记

- **the &lt;strong&gt; Element**

文件中没有 HTML 标记

还有什么我没注意的吗?我对跨不同编程语言(Python、JavaScript 等)的解决方案持开放态度,期待回答您的更多问题。

【问题讨论】:

  • 你在那里做了一些很好的侦探工作,找到了两者之间不同的类名,如果你寻找应用于这些类的 css 属性,我想你会找到答案:@987654331 @ 和 ls1 用于粗体文本。找到这些道具并将它们添加到这里 - codesandbox.io/s/keen-swartz-pu8us 看看它是否有效。
  • 感谢您的客气话和回复。我刚刚将 ls1 的 css 属性添加到链接中,没有区别。但是,我的 HTML 文件没有 _ _1 的 css 属性,这很奇怪吗?此外,当我进一步挖掘时,我发现并非所有粗体字符 (_ _1。没有非粗体字符具有_ _1 css 属性

标签: javascript python html css python-3.x


【解决方案1】:

CSS 可以通过另一个页面(如 bootstrap)生成一些粗体字母。

好吧,也许有一些标签被过滤并放了一个样式,比如在 js 中检查包含正确的东西是粗体。

它也与转换器有关。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多