1

I'm creating an HTML Help file (yeah, yeah, I know it's old fashioned but Microsoft has yet to provide a newer replacement).

When I open the file in a normal browser, the text appears how I expect. But when I open the file in the HTML help viewer, the first line within each <dd> element is indented, which I don't want.

enter image description here

Here's my CSS file.

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;
}

And here's part of my 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>

Can anyone understand why the first line is being indented here? I've tried setting text-indent: 0 with no success. I also tried changing the DOCTYPE to <!doctype html>, but nothing changes this.

Jonathan Wood
  • 65,341
  • 71
  • 269
  • 466
  • 1
    Who the hell downvotes a question without saying why? Just because you don't have the answer, that doesn't make the question bad! – Jonathan Wood Sep 27 '17 at 00:54
  • I seem to recall having a similar issue to this **many** years ago. I think I abandoned `dl` because I couldn't get the help viewer to style them as I wanted. – Jon P Sep 27 '17 at 01:07
  • Does help viewer recognize the `:first-line` pseudo selector? – disinfor Sep 27 '17 at 01:12
  • @disinfor: Surprisingly, setting no indent for `dd::first-line` does not work either. I can only assume the HTML Help browser is funky, although I would've guessed it would be using components from Edge or IE to keep the rendering engine more current. (Just tried viewing my HTML file with Internet Explorer and it does not indent.) – Jonathan Wood Sep 27 '17 at 01:17
  • @JonP: Yeah, originally I used `

    ` tags with a CSS class. But that requires **much** more typing.

    – Jonathan Wood Sep 27 '17 at 01:19
  • Completely irrelevant side note.... your ADO Helper from way back in 2011 is pretty timeless! – Jon P Sep 27 '17 at 01:41
  • @JonP: Heh, that was a while ago. Thanks. – Jonathan Wood Sep 27 '17 at 01:43

2 Answers2

2

Add the following statement to the <head> section of all your HTML files. This works if the HTML topic files are encapsulated in a .chm help file.

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

e.g.:

<!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>

enter image description here

For further information have a look at our FAR HTML knownledge base CSS3 in FAR Browser

and Rick Strahl's Web log Make your CHM Help Files show HTML5 and CSS3 Content

help-info.de
  • 6,695
  • 16
  • 39
  • 41
  • Yes indeed, that was the issue. Looks like HTMLHelp's default settings tell it to completely ignore some CSS settings. Who would have thought? – Jonathan Wood Sep 27 '17 at 15:06
0

You can add text-indent:0; to the CSS rule for dd, and maybe also try to add !important if it doesn't work as is.

If that doesn't work, it might be due to specifity (a more complex selector overriding it).

You could also

  1. Try to use inline styles in the HTML, like <dd style="text-indent: 0;"> A handle ...

  2. Try to use a more specific CSS selector in your stylesheet, like body dt dd {...}

By the way: I just saw that - at least in your example code above - you don't have a body tag...

Jonathan Wood
  • 65,341
  • 71
  • 269
  • 466
Johannes
  • 64,305
  • 18
  • 73
  • 130