• I am wanting to color code my “code” and I have what I think should work in my css file and in my posting html file. I’ve shown the relevant parts below. It seems to ignore my kwrd class definition. Any help would be appreciated.

    CSS:
    pre {border: solid 1px black;
    font-size: 1.3 em;
    color: black;
    margin: 10px;
    padding:10px;
    background: #FFFFFF}
    code {font-size:1.2em;
    color: #008099}

    .csharpcode
    {
    font-size: small;
    color: black;
    font-family: Courier New , Courier, Monospace;
    background-color: #ffffff;

    /*white-space: pre;*/
    }
    .rem { color: #008000; }
    .kwrd { color: #0000ff; }

    Posting HTML:

    <pre class=”csharpcode”>
    [DataObject(<span class=”kwrd”>true</span>)] <span class=”rem”>// This attribute allows the </span>
    <span class=”kwrd”>public</span> <span class=”kwrd”>class</span> MembershipDataObject
    {
    <span class=”rem”>/// <summary></span>
    <span class=”rem”>/// An empty constructor is necessary for iterator in Get</span>
    <span class=”rem”>/// </summary></span>
    <span class=”kwrd”>public</span> MembershipDataObject()
    {
    }</pre>

Viewing 1 replies (of 1 total)
  • I made a test file, looks ok I think:
    Colored Code Test

    2 things though: the validator doesn’t like the <summary> tag, at least not with the strict doctype I used in my testfile, and you had one error in the css:

    font-size: 1.3 em;

    (Space between number and unit is not correct)

    Sanne

Viewing 1 replies (of 1 total)
  • The topic ‘Trouble Getting Color into <pre> section’ is closed to new replies.