Forums

Trouble Getting Color into <pre> section (2 posts)

  1. pkellner
    Member
    Posted 4 years ago #

    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>

  2. SanneK
    Member
    Posted 4 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags