I am currently updating the site for someone, and I am trying to get rid of the global @font-face and apply it only to certain elements.
It was defined as follows:
@font-face { font-family: "neutra"; src: url( /styles/NeutraDisp-Bold.eot ); src: local("Neutra Display"), url( /styles/NeutraDisp-Bold.ttf ) format("truetype"); } @font-face { font-family: "futura"; src: url( /styles/FuturaStd-Heavy.eot ); src: local("Futura Std"), url( /styles/FuturaStd-Heavy.ttf ) format("truetype"); } html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { font-family: neutra, Arial, Helvetica, Tahoma, Geneva, sans-serif; }
I only want it on a div that has the .header and legend class (and a few other tags, after all), so I changed the CSS to look like this:
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { font-family: Arial, Helvetica, Tahoma, Geneva, sans-serif; } @font-face { font-family: "neutra"; src: url('../../styles/NeutraDisp-Bold.eot'); src: local("Neutra Display"), url('../../styles/NeutraDisp-Bold.ttf') format("truetype"); } @font-face { font-family: "futura"; src: url('../../styles/FuturaStd-Heavy.eot'); src: local("Futura Std"), url('../../styles/FuturaStd-Heavy.ttf') format("truetype"); } legend{ font-family: neutra, Helvetica, Arial, sans-serif; letter-spacing: .125em; -webkit-border-radius: .5em; -moz-border-radius: .5em; border-radius: .5em; } .header{ width: 75em; height: 12.375em; background-color: #FFFFFF; margin: auto; font-family: neutra, Helvetica, Arial, Tahoma, Geneva, sans-serif; }
However .header font-family ignored. All other declarations in this rule are used, and Firebug shows a font-family , which indicates that it is really CSS.
In addition, the legend rule works fine and displays the correct font.
Note. I started moving fonts and other things when I started working, but I know that the new font paths are correct, because the legend rule works. I also tried "neutra" and 'neutra' .
A pastebin of all CSS is here if you think the problem is somewhere else. I also created jsfiddle with the font turned on to see an example of ignoring it.
The old Jsfiddle update does everything you need. I have no idea what is different in my own code.
Update
I added an insult rule. I think I'm missing something about rule weights, so there would be a lower rule not exceeding a higher one.