/    Sign up×
Community /Pin to ProfileBookmark

Setting how many lines does a div have

Here I’m, again with my syntax highlighter system. I have a div in wich I show the highlighted code. I want it to show line’s number and these must have a different background color than the div, just like dreamweaver does, like this:

  • 1. line of code

  • 2. line of code

  • 3. line of code

  • 4. line of code
  • And imagine that 1., 2., 3., 4. are remarked. I don’t have a clue about how to start to do something like this. Any approach you could mention to me would be really appreciated. Thanks.

    to post a comment
    JavaScript

    2 Comments(s)

    Copy linkTweet thisAlerts:
    @Declan1991Jun 24.2008 — There is two ways to do it, and I think I prefer the latter. The first:<i>
    </i>&lt;span&gt;1.&lt;/span&gt;Line of code

    <i>
    </i>&lt;ol id="code"&gt;
    &lt;li&gt;&lt;span&gt;Line of code&lt;/span&gt;&lt;/li&gt;
    &lt;/ol&gt;

    The reason for the inner span is so that you can highlight the numbers differently.<i>
    </i>#code li {
    color:whatever;
    }
    #code li span {
    color:whatever;
    }
    Copy linkTweet thisAlerts:
    @mariano_donatiauthorJun 24.2008 — Thanks. I'll apply it.
    ×

    Success!

    Help @mariano_donati spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.18,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...