CSS is weird

admin

Administrator
Staff member
Tell me, what's wrong with this code?

<head>
<style>
.stylename {color:#000000;
font-family:verdana;
font-size:10}
</style>
</head>
<basefont class="stylename">

It sometimes works and sometimes it does not
the font-size thing hardly ever works
And font-family almost always worksProperty values nearly always require units; em, px, % etc.
font-size:10px;

When using font-family give alternatives and a generic type:
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
You can combine the font properties:
font:10px Verdana, Geneva, Arial, Helvetica, sans-serif;

<basefont> is depreciated and should not be usedAnd your font-size needs a unit of measure, probably px.Base values should be applied to the BODY tag.

body {
color:#000000;
font-family:verdana,serif;
font-size:1em;
}

As units of measure go, I find more cross-browser consistency using EM. They also scale in IE too, not like PX.<head>
<style>
.stylename {color:#000000;
font-family:verdana;
font-size:10;}
</style>
</head>
<basefont class="stylename">
But I prefer the cleaner style of :

<head>
<style>
.stylename {color:#000000; font-family:verdana; font-size:10;}
</style>
</head>
<font class="stylename>

I just have it set my way because it's cleaner and a LOT faster to edit. I also like to see the quick and easy styles when I'm doing something fast.^^ It isn't though because you're applying CSS to a FONT tag. Applying the CSS to the BODY does the same thing with the added bonus of giving all new elements a default css font value.GageEndal you are using the same construction as Lixuz's problem!
It's wrong, do not use it.GageEndal you are using the same construction as Lixuz's problem!
It's wrong, do not use it.
It's worse actually (his)
class=".whatever"
There's no dot before whatever
and basefont tag works better than plain "font"

Fang, what do you mean by basefont is depreciated?
And I think I've tried adding px and things like that
but I will try again

Thanks guyswhat do you mean by basefont is depreciated?
<!-- m --><a class="postlink" href="http://www.w3.org/TR/html401/present/graphics.html#edef-BASEFONTBasically">http://www.w3.org/TR/html401/present/gr ... TBasically</a><!-- m -->, the correct construction would be like so.
<style type="text/css">
body{
color:#000;
font-family:verdana, sans-serif;
font-size:1em;
}
</style>basefont hasn't been included in HTML since '98 and with good reason."verdana, serif" ???body {
color:#000;
/* always give the body a background color; the user maybe using a different default color */
background:#fff;
/* font-size in relative units; font-family with prefered, alternative(s) and default */
font:1em Verdana, Geneva, Arial, Helvetica, sans-serif;
}"verdana, serif" ???Oops! Sorry. will fix.body {
color:#000;
/* always give the body a background color; the user maybe using a different default color */
background:#fff;
/* font-size in relative units; font-family with prefered, alternative(s) and default */
font:1em Verdana, Geneva, Arial, Helvetica, sans-serif;
}
I've got my browser set to an ugly pink background by default just so I can see who's paying attention and who isn't. At least half the sites I visit have no background color set.I've got my browser set to an ugly pink background by default just so I can see who's paying attention and who isn't. At least half the sites I visit have no background color set.
Ooh, that's mean. :DI've got my browser set to an ugly pink background by default just so I can see who's paying attention and who isn't. At least half the sites I visit have no background color set.
Maybe a lot of people have pink backgrounds :DLord I hope not! ;-)
 
Back
Top