0

我正在创建一个 HTML 帮助文件(是的,是的,我知道它是老式的,但微软尚未提供更新的替代品)。

当我在普通浏览器中打开文件时,文本会按照我的预期显示。但是当我在 HTML 帮助查看器中打开文件时,每个<dd>元素中的第一行都会缩进,这是我不想要的。

在此处输入图像描述

这是我的 CSS 文件。

body 
{
  color: #111;
  font-family: Arial, Helvetica, Sans-Serif;
  font-size: 12px;
}
dt {
  font-weight: bold;
  margin-top: 8px;
  margin-bottom: 8px;
}
dd {
  margin-left: 18px;
}
pre {
  color: blue;
}

这是我的 HTML 的一部分。

<!doctype html public "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta http-equiv="Content-Type" Content="text/html; charset=Windows-1252">
<title>CYGNUSSTATEINFO Structure</title>
<link href="Style.css" rel="stylesheet" type="text/css" />
</head>

<h1>CYGNUSSTATEINFO Structure</h1>

<p>
The CYGNUSSTATEINFO structure contains information about the current state and settings of the Cygnus application. This information may be useful for programming extensions that need more information about the data being processed. This structure contains the following members.
</p>

<dt>HWND hCygnusWnd</dt>
<dd>
A handle to the main Cygnus window.
</dd>

<dt>LPWSTR lpszCurrFile</dt>
<dd>
A Unicode string that specifies the name of the current file being edited. Note that this member is for display purposes only and does not contain a fully qualified path.
</dd>

<dt>int nStartOffset</dt>
<dd>
Specifies the offset of the start of any selection. This may be useful when it is necessary to know the offset of the data being processed. This member is zero if there is no selection associated with the current task.
</dd>

<dt>int nBytesPerRow</dt>
<dd>
Specifies the current number of bytes per row.
</dd>

<dt>int nOffsetRadix</dt>
<dd>
Specifies the current offset radix. This is the notation used to show the offset of each row. It will be 16 for hexadecimal, 10 for decimal.
</dd>

<dt>int nGroupBy</dt>
<dd>
Specifies the number of bytes per group in the hex portion of the display. This value is one if there is no byte grouping.
</dd>

<!-- Etc.... -->

</body>
</html>

谁能理解为什么第一行在这里缩进?我试过设置text-indent: 0没有成功。我也尝试将 DOCTYPE 更改为<!doctype html>,但没有任何改变。

4

2 回答 2

2

将以下语句添加到<head>所有 HTML 文件的部分。如果 HTML 主题文件封装在 .chm 帮助文件中,则此方法有效。

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11"/>

例如:

<!doctype html public "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta http-equiv="Content-Type" Content="text/html; charset=Windows-1252">
<title>CYGNUSSTATEINFO Structure</title>
<link href="Style.css" rel="stylesheet" type="text/css" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11"/> 
</head>

在此处输入图像描述

有关更多信息,请查看 FAR 浏览器中的 FAR HTML 知识库CSS3

和 Rick Strahl 的 Web 日志使您的 CHM 帮助文件显示 HTML5 和 CSS3 内容

于 2017-09-27T10:16:44.240 回答
0

您可以添加text-indent:0;到 CSS 规则中,如果它不能按原样工作,dd也可以尝试添加。!important

如果这不起作用,可能是由于特殊性(覆盖它的更复杂的选择器)。

你也可以

  1. 尝试在 HTML 中使用内联样式,例如<dd style="text-indent: 0;"> A handle...

  2. 尝试在样式表中使用更具体的 CSS 选择器,例如body dt dd {...}

顺便说一句:我刚刚看到 - 至少在你上面的示例代码中 - 你没有body标签......

于 2017-09-27T00:31:45.587 回答