whenever a code format (means any code written in c or c++, or any other language) is found , the background color changes itself to grey , else all the text(theoritical part) remains in the same white background, how this can be done using css and jsp.
A:
Will need to define a span or div with a particular id or class assigned, then just define a background colour for that id or class in your css and it'll be done.
pedromarce
2009-10-16 09:03:31
A:
If what you're doing is something like a forum, use a method of wrapping code. It's not a major inconvenience, as you can see on SO you have spacing in front of lines, and on forums using BBcode you'll have things like [code].
In any case, trying to automatically detect code is not a very good idea, as false positives could easily be triggered.
Then take the code and wrap it in a tag like <code>, and style it. Stack Overflow isn't an education site, so learn about CSS yourself. Searching things on the internet isn't hard... unless you've never used the internet.
a2h
2009-10-16 09:25:46