2

有没有办法为 HTML 中的字符设置固定大小?这意味着,比如说……</p>

第一行第8个字符是“Z” 第二行第8个字符是“A”</p>

我想打印出来,打印时“Z”必须正好在“A”之上</p>

*注意:我在 QTextEdit() 中使用了 insertHtml 方法

4

2 回答 2

3

What you're asking for is called a fixed-width font. As James Hopkin remarked, HTML text in <tt> or <pre> tags is rendered with a fixed-width font.

However, what you describe sounds like a table. HTML has direct support for that, with <table>, <tr> (row) and <td> (data/cell). Don't bother with fixed-width fonts; just put your A and the Z in the second <td> of their rows.

于 2010-06-09T11:37:10.647 回答
0

将文本放在<tt>标签中(或<pre>整段文本)。

于 2010-06-09T11:22:23.077 回答