Hi,

Im trying to add code tags to my CSS.

Ive added the following to my CSS :

code {
    background-color: #F9F9F9; 
    border: 1px dashed #444444;
    color: black;
    font-family: momspace,"courier new";
    line-height: 1.1em;
    padding: 1em;
}

But when running my site in firefox the browser doesnt even seen the new entry in the CSS and in IE 8 it displays it but incorrectly.

A test page I have can be found here : http://fir3net.com/TEST/f5-ltm-basic-nat.html

Thanks...

Recommended Answers

All 4 Replies

"code" is not a valid HTML tag. Browsers don't know what to do with it. You should make a class named code and then put that class on a div.

as reported by MM, css only works on valid tags, you cant add new tags
the [code=php] tags used on forums like this are not html, they are a plugin called bbcode, note square brackets, which is interpreted when the page is built and displayed in html, with colorcoding

.code {} // for a <element class='code'> multiple elements
#code {} // for a <element id='code'> single element only

Thanks for your help Ive now added custom "code" classes which works fine.

Member Avatar for GreenDay2001

You can search for such scripts/plugin which almostbob mentioned on Google easily. You can use many of them on simple web pages as well. One such script that I've used in past is http://code.google.com/p/syntaxhighlighter/.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.