# 链接到（本地）PDF 文件的格式渲染？

**URL:** <https://meta.discourse.org/t/format-rendering-of-links-to-local-pdf-files/135639>\
**Category:** Support\
**Created:** [2019年十二月11日 10:30 UTC](https://meta.discourse.org/t/format-rendering-of-links-to-local-pdf-files/135639 "2019-12-11T10:30:34Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)\
**Post date:** [2019年十二月11日 19:31 UTC](https://meta.discourse.org/t/format-rendering-of-links-to-local-pdf-files/135639/2 "2019-12-11T19:31:53Z")

</div>

据我所知，单框功能仅适用于外部链接的 PDF 文件，而不适用于上传的文件。

通过 CSS，您可以实现类似以下效果：

```scss
a.attachment[href$=".pdf"] {
    color: red;
    &:before {
      // 附件图标是通过伪选择器添加的
     // 因此您需要在此处编辑其样式
    }
}

```

这段代码仅对具有 `attachment` 类且 `href` 属性以 `.pdf` 结尾的链接应用样式。

---

_[View the full topic](https://meta.discourse.org/t/format-rendering-of-links-to-local-pdf-files/135639)._
