| re: css syntax
sam wrote:[color=blue]
> Hi,
>
> Does anyone know why there is a hash (#) in front of each css style?
> please see the following example:[/color]
That's how you indicate a match on an element's ID attribute.
[color=blue]
> <style type="text/css">
> #leftcolumn{
> float:left;
> width:150px;
> height: 400px;
> border: 3px solid black;
> padding: 5px;
> padding-left: 8px;
> }[/color]
[snip]
[color=blue]
> It should be without hash,[/color]
No, it shouldn't be. (Besides, if you already knew that it should be,
then why didn't you just delete the hash instead of asking why it's there?)
I usually use the following css syntax:[color=blue]
>
> body{ background-color: black }
> p { color: blue; }
> h3{ color: white; }[/color]
These apply, respectively, to <body>, <p>, and <h3> elements in an HTML
document. The styles you listed are meant to match elements with
id="leftcolumn" or id="rightcolumn". (There are no <leftcolumn> or
<rightcolumn> elements.) Similarly, names preceded by a period are meant
to match elements whose class attributes include those names. |