问题标签 [pre]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
html - 如何在标题中显示预先格式化的数据?
我是 HTML 新手。我正在尝试以下代码工作,但它没有。谁能帮我解决为什么<pre> tag
不在里面工作<h> tags
?我也尝试对标签进行编码,但也没有用。
php - 使用标签在列中显示数据?
我正在使用 PHP,我想显示一些我在数组中的数据(来自 mysql db)。问题是第一列并不总是具有相同的长度,因此虽然第一列中包含较短字符串的某些行都对齐良好,但在具有较大字符串的那些行中,第二列更向右对齐。数组如下所示:
我想一个解决方案。获取数组[$i][0]中较长字符串的长度,然后设置一个带有X个空格的变量和一个制表符(X是较长的字符串长度),但这似乎不起作用.
这是我的代码:
但它显示:
有人对此有解决方案吗?
javascript - 将 pre 转换为 div
您将如何进行转换:
对此:
即:将连续空行* s*(可能包含空格/制表符和多个换行符)替换为</pre></div><div><pre>
我试过了 :
部分工作:每一行都改变了,我松开了我的块。
<pre>
换行符是否存储为 \r ?\n ? (所有操作系统?所有浏览器?)
什么是一个好的正则表达式来做到这一点?
你有什么其他的方法可以建议我继续吗?
javascript - How are whitespace and line return "saved"?
If you want to toy with white-spaces, tabs, linefeed and carriage-return, how do you "select them" in javascript?
edit : ^Does not work for linefeed and carriage-return.
Now, tabs are /(\t)/ and spaces are /( )/.
css - 在不同的 Web 浏览器中设置 PRE 选项卡宽度
在 Firefox 和 Opera 中有一种设置 PRE 选项卡宽度的方法,但在 IE 或 Chrome 中没有一种众所周知的方法来执行此操作,因此 PRE 标记中的硬选项卡代码会受到影响。
html - pre标签中没有忽略空格
我已经读过'pre'标签会将所有空格和制表符折叠到一个空格中,但对我来说并没有这样做。
为什么会这样?它取决于网络浏览器还是我应该做更多的事情?
jquery - 在 a 中断开文本行标签
我在 chrome 中有我的代码片段的屏幕截图:
在火狐中:
我的问题是,如何在 Firefox 中制作与在 chrome 中相同的效果?代码片段部分位于 pre 标记内。非常感谢您的帮助!:)
html - Creating a variable width element with optional scrollbars
I want to add div to my website which has variable width, and that it will display scroll bars when the width is smaller than the longest line. I tried wrapping such a fixed width element, in a variable width (100%) but that didn't work. I got the scroll bars on the entire page.
Any thoughts?
Thanks Yaron
html - CDATA 不适用于 A 中的 C++ 代码标签
我在pre
标签内输出一些 C++ 时遇到问题。
我拥有的 XHTML 代码是:
但是当我尝试查看网页时,我只看到
并不是
如我所愿。
CDATA
我对行为有什么不明白的地方?
php - 使用 phpQuery 解析 html:如何处理 pre 标记内的 C++ 代码?
在数据库中,我有一些像这样的代码
当我尝试使用 phpQuery 进行解析时,它会失败,因为它<cstdio>
被解释为标签。
我可以使用htmlspecialchars
但仅在pre
标签内应用它,我仍然需要进行一些解析。我可以使用正则表达式,但它会更加困难(我需要处理pre
标签的可能属性)并且使用解析器的想法是避免这种正则表达式的事情。
做我需要做的最好的方法是什么?