CSS font override

Need technical advice on coding your web pages? Covers HTML, JavaScript, CSS, and some server side technologies. Also the issue of some webpages not displayed well.

Moderator: Don_HH2K

CSS font override

Postby Don_HH2K » Wed 12 Jan, 2005 4:31 pm

This is sort of a two-part question. Is there any way to specify a second font for a page if the first font isn't installed on the user's computer via CSS, and second, is there any way to get that to override any font information in STYLE tags embedded in an HTML page?
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (Donzilla/0.4)
Laptop: HP Compaq nx6325 - Turion 64 X2 @ 2GHz, 2GB DDR2, 100GB HD, ATI Radeon X300, 15" LCD, Seven Pro
Handheld: Palm Treo 650 - Intel PXA270 @ 312MHz, 10MB RAM, 32MB flash, 2.7" LCD, Palm OS 5.4
User avatar
Don_HH2K
Moderator
Moderator
 
Posts: 5112
Joined: Sun 09 May, 2004 3:59 pm

Re: CSS font override

Postby Antony » Wed 12 Jan, 2005 5:20 pm

dluchini30 wrote:This is sort of a two-part question. Is there any way to specify a second font for a page if the first font isn't installed on the user's computer via CSS,
Same as using the [tt]<font face="Bookman, Times Roman, serif">[/tt] tag. It's called [tt]font-family[/tt] in CSS.
e.g.
[tt]{font-family: Bookman, "Times Roman", serif;}[/tt]

dluchini30 wrote:and second, is there any way to get that to override any font information in STYLE tags embedded in an HTML page?
As from user side? Sure, plenty of way.
With Mozilla (and the attitude of Mozilla users*), you can simply disable Style Sheet completely, or selectively not follow certain CSS specifications. Simply go to the [tt]chrome[/tt] folder under your profile, and change [tt]userChrome.css[/tt] and [tt]userConetnet.css[/tt].
(If you are doing this for the first time, copy [tt]userChrome-example.css[/tt] and [tt]userConetnet-example.css[/tt] to [tt]userChrome.css[/tt] and [tt]userConetnet.css[/tt], and modify the content.)

(*) (off topic) The attitude of Mozilla users refers to those who choose to block any thing they don't feel happy to see. They want web pages completely ad free. I highly doubt those people would pay for commercial-free TV. And all printed newspaper and magazines are filled with advertisements to cut down the cost. (End of my off topic)
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.5.5 (KHTML, like Gecko) Safari/125.12
User avatar
Antony
diamond member
diamond member
 
Posts: 14509
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Postby Don_HH2K » Wed 12 Jan, 2005 5:52 pm

Thanks Antony. I knew about font-family but wasn't sure about how to specify multiple fonts.

Anyway, I mean disabling any STYLE element for font-face via CSS, not via a local file, so that everybody can view it in that manner.
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (Donzilla/0.4)
Laptop: HP Compaq nx6325 - Turion 64 X2 @ 2GHz, 2GB DDR2, 100GB HD, ATI Radeon X300, 15" LCD, Seven Pro
Handheld: Palm Treo 650 - Intel PXA270 @ 312MHz, 10MB RAM, 32MB flash, 2.7" LCD, Palm OS 5.4
User avatar
Don_HH2K
Moderator
Moderator
 
Posts: 5112
Joined: Sun 09 May, 2004 3:59 pm

Postby Antony » Wed 12 Jan, 2005 5:56 pm

dluchini30 wrote:Anyway, I mean disabling any STYLE element for font-face via CSS, not via a local file, so that everybody can view it in that manner.
Just don't specify any typeface?
Or just specify [tt]serif[/tt], [tt]sans-serif[/tt]?

OR are you referring to some web space providers that specifies the typeface, and you have no control over it?
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.5.5 (KHTML, like Gecko) Safari/125.12
User avatar
Antony
diamond member
diamond member
 
Posts: 14509
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Postby Don_HH2K » Wed 12 Jan, 2005 6:09 pm

What I mean is that I've got pre-existing font-face CSS content up at my website embedded with STYLE tags in my markup, but I'm too lazy to go through all the pages and remove all references to font-face, and instead just want to somehow specify to override font-face CSS markup embedded in the document via a master CSS stylesheet.

Maybe I'm thinking of something that can't be done. Can I somehow, maybe, disable the font-face element through JavaScript (seems more plausible) and then add it to the CSS document, where JavaScript can't disable it?
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (Donzilla/0.4)
Laptop: HP Compaq nx6325 - Turion 64 X2 @ 2GHz, 2GB DDR2, 100GB HD, ATI Radeon X300, 15" LCD, Seven Pro
Handheld: Palm Treo 650 - Intel PXA270 @ 312MHz, 10MB RAM, 32MB flash, 2.7" LCD, Palm OS 5.4
User avatar
Don_HH2K
Moderator
Moderator
 
Posts: 5112
Joined: Sun 09 May, 2004 3:59 pm

Postby Antony » Wed 12 Jan, 2005 6:31 pm

dluchini30 wrote:What I mean is that I've got pre-existing font-face CSS content up at my website embedded with STYLE tags in my markup, but I'm too lazy to go through all the pages and remove all references to font-face, and instead just want to somehow specify to override font-face CSS markup embedded in the document via a master CSS stylesheet.
I just had a quick look about the pages. As for removing each individual STYLE attitude. The easiest way is to use a reasonable powerful text editor(*) (plain text editor, not MS Word) with RegEx (Regular Expression) support. And you can remove all the [tt]STYLE[/tt] attitudes in one search/replace.
Replace [tt]style="[^"]*"[/tt] with (empty) will strip all [tt]STYLE[/tt] attitudes.
(Note: not tested, you will need to check the reference manual of the software you use, some may vary in syntax.)

(*) something like UltraEdit or BBEdit.
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.5.5 (KHTML, like Gecko) Safari/125.12
User avatar
Antony
diamond member
diamond member
 
Posts: 14509
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia


Return to Web Design and Page Coding

Who is online

Registered users: Google [Bot]