Google Answers Logo
View Question
 
Q: VERY simple HTML/css question ( Answered 5 out of 5 stars,   3 Comments )
Question  
Subject: VERY simple HTML/css question
Category: Computers > Programming
Asked by: davidfilmer-ga
List Price: $2.50
Posted: 17 Jun 2003 13:08 PDT
Expires: 17 Jul 2003 13:08 PDT
Question ID: 218464
Greetings.

I wish to globally force the default font face for an entire page,
without the need to enclose text within any particular tags.

I can do this for text color (using the 'text=' attribute in the
<body> section), but I know of no global <body> attribute to specify
font face.

Likewise, I don't know how to use css to force characteristics of
objects unless they're enclosed in some sort of tag (<a>, <p>, <h1>,
etc).

I suspect there's a css instruction that I can include in a 'style='
attribute within the <body> tag that will apply globally...

hmmm?
Answer  
Subject: Re: VERY simple HTML/css question
Answered By: sgtcory-ga on 17 Jun 2003 13:37 PDT
Rated:5 out of 5 stars
 
Hello davidfilmer,

Great questions!


Q. I wish to globally force the default font face for an entire page,
without the need to enclose text within any particular tags?
-------------------------------------------------------------------------------

The way to do this is with the 'font-family' designation :

Example :

<body style="font-family:helvetica;">


Optionally, you can include this in the header of your document as
well, and designate it for the whole body :


<style type="text/css">
<!--
BODY { font-family:arial; }
-->
</style>



Q. Likewise, I don't know how to use css to force characteristics of
objects unless they're enclosed in some sort of tag (<a>, <p>,
<h1>,etc)?

-------------------------------------------------------------------------------

You would do the same above to apply different font families to each
respective tag - like this :

<style type="text/css">
<!--
A { font-family:helvetica; }
-->
</style>


This means you can assign two different families, and it would work
fine :

<style type="text/css">
<!--
A { font-family:courier; }
BODY { font-family:arial; }

-->
</style>


This command degrades well, as I just tested it in Netscape 4.7 and it
works fine. It will apply to the tags you have listed with no
problems. The only time it will not apply, is of course, when you are
applying other styles to override these ones.


Search Strategy Used :
Prior knowledge, but here is some more pertinent information -
http://css.nu/examples/dep-examples.html



I hope this answers your question to your satisfaction. Please do not
hesitate to ask for clarification should you need it. I would be more
than happy to assist. Thanks again!

SgtCory
davidfilmer-ga rated this answer:5 out of 5 stars and gave an additional tip of: $2.50
Great answer. You could have simply said 

   <body style="font-family:helvetica;"> 

and it would have answered the question.  I appreciate your extra
effort and information, and have expressed this appreciation in a
small gratuity.

Comments  
Subject: Re: VERY simple HTML/css question
From: sgtcory-ga on 17 Jun 2003 13:39 PDT
 
Hmmm - my link didn't work. Here it is again :

http://www.css.nu/examples/dep-examples.html
Subject: Re: VERY simple HTML/css question
From: sgtcory-ga on 17 Jun 2003 16:01 PDT
 
Hello again davidfilmer,

Thanks for the great rating and the tip. I look forward to helping you
again anytime -

SgtCory
Subject: Re: VERY simple HTML/css question
From: owain-ga on 18 Jun 2003 11:22 PDT
 
If you need to apply a style to some text that isn't contained in a
tag, you can use <SPAN> and </SPAN> tags. Here's an effect I made on
www.stirlingcity.org.uk

<H1 STYLE="border-top: medium #0000FF solid; border-bottom: medium
#0000FF solid">Braveheart Country
<SPAN STYLE="font-style: italic; background-color: #FFFFFF; color:
#0000FF; font-weight: bold; background-color:
#FFFFFF">stirlingcity.org.uk</SPAN></H1>

Owain

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy