Using CSS Style Sheet with HTML pages

Sep 16, 2009 at 9:46 PM

I am trying to create a Sandcastle project where the additional content is comprised of HTML pages. I am trying to use CSS from a CSS file. Now while my pages look fine in a browser, when compiled via Sandcastle none of the features in the CSS file are applied. To get the styles applied I seem to have to physically include the contents of the style sheet in the <style> section in the header.

I am using referencing the style sheet in the following manner:

<html>
    <head>
           <title>nnnn Details</title>
           <link rel="StyleSheet" href=".\nnn.css" type="text/css">
    </head>

...

Is it possible to use a stylehseet with Sandcastle and if so how does one do this?

 

Sep 16, 2009 at 11:20 PM

>>neridan: Is it possible to use a stylehseet with Sandcastle and if so how does one do this?

Even though there is no official release yet, the PostTransComponents (Reference and Conceptual)
in the Sandcastle Assist build components, allow you to include your own styles and scripts:

http://sandassist.codeplex.com/Wiki/View.aspx?title=Sandcastle%20Build%20Components

Best regards,
Paul.

Editor
Sep 17, 2009 at 2:34 AM

The most likely cause for the styles not being applied is that it can't find the stylesheet file.  You might check to be sure that you included the stylesheet file in the project and that it is a content item.  You need to make sure that the path to the CSS file is correct too.  If the the stylesheet is in the same folder as the HTML files, it should find it.  If the stylesheet is in another folder, you will need to provider a proper relative path to the file:

If the stylesheet file is in a subfolder relative to the current folder in which the HTML files are stored:

<link rel="stylesheet" type="text/css" href="styles/MyStyles.css" />

If the stylesheet file is in a subfolder and the HTML files are in a different subfolder (i.e. html\CustomPage.html), you need to go up one level:

<link rel="stylesheet" type="text/css" href="../styles/MyStyles.css" />

If you are using the Sandcastle Help File Builder, build a website version of the project and see if the stylesheet is there and in the expected location.

Eric

 

Sep 30, 2009 at 4:27 AM

The problem was that I was not including the css file in my sitemap. Once I included it there all styles worked.