使用 word-wrap: pre? 更改元素上的制表符大小

发布于 2024-07-10 10:09:11 字数 113 浏览 10 评论 0原文

我有一个类似于标签的元素(因为它有 word-wrap: pre;)来在网站上显示代码。 唯一的问题是选项卡尺寸太大,导致元素经常水平滚动,因为它的宽度是固定的。

是否可以更改选项卡大小?

I have an element that is similar to a tag (because it has word-wrap: pre;) to display code on a website. The only problem is that the tab size is too large and causes the element to horizontally scroll often because it is of fixed width.

Is it possible to change the tab size?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧竹 2024-07-17 10:09:11

您可以用空格替换制表符。 然后您可以精确控制缩进的大小。

You could replace tabs with spaces. Then you could control exactly the size of the indents.

痴骨ら 2024-07-17 10:09:11

我们需要更清楚地了解您的问题,但是您是否正在寻找 text-indent css 属性? 您可以设置缩进量,例如:

<style type="text/css">
p {
  text-indent: 40px;
}
</style>

We need some more clarity into your question, but are you perchance looking for the text-indent css property? You can set the indentation amount, e.g.:

<style type="text/css">
p {
  text-indent: 40px;
}
</style>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文