On 5/15/07, Lauri Pantos <[EMAIL PROTECTED]> wrote:
>
> Hi.
> #1 what would be the advantage of defining styles in the head instead of
> the body?
Hi Lauri.
I guess I'd answer 'Reusability and Maintainability' for that one.
Granted, it depends on how you are defining the styles, but if we compare
<head>
<style type="text/css">
.Highlight
{ background-color: red; }
</style>
</head>
vs (somewhere in the body)
<div style="background-color: red;">This should be highlighted</div>
It seems fairly equivalent *at first sight*.
However, it is quite possible that you wish to have different elements in
the same page sharing style.
So, if I had 4 or 5 divs that need to be highlighted, I can define the
.Highlight style in the head
and apply it to all of those elements, instead of having to give each of
them their own style attribute.
The day we want to change the Highlight style from a red background to, say,
being underlined and bold text,
we can do so in a single place.
Of course, the same concept extends farther to style you wish to share
across multiple pages.
That's why I'd reccomend using external stylesheet and simply importing them
from your head element:
<head>
<link rel="stylesheet" type="text/css" href="myStyles.css" />
</head>
(or by using an import statement, of course).
#2 is it normal that the style info looks to be commented out, but still
> works?
> http://www.somtndesign.com/contactus2ak.htm
Well, in that page you are 'commenting' the styles by using the HTML comment
delimiters (<!-- .. -->).
Those are not CSS comment delimiters, so modern browsers will still read the
CSS
and use them.
There's a bit about CSS comments over at the W3C school site:
http://www.w3schools.com/css/css_syntax.asp
Also, see this page to see how the HTML comments impac styles defined in the
page:
http://www.w3schools.com/css/css_howto.asp
HTH,
F.O.R.
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7 information -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/