h1 or .h1

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Looking through an old style sheet I see the hx tags have a duplicate with a
"." before them.

For the life of me I don't recall why there are two types and a search
through Google doesn't throw any light.

Any theories appreciated.  Thanks


Re: h1 or .h1

PeterL wrote:
Quoted text here. Click to load it

h1 is a type selector, it matches every h1 element.

.h1 is a class selector, it matches every element with the class h1, so
it would match <p class="h1"> as well as <span class="h1"> and (of
course) <h1 class="h1">.

See <http://www.w3.org/TR/CSS2/selector.html for all legal CSS2 selectors.

 > Any theories appreciated.

You must have had some reason. Or perhaps it was the booze.


Re: h1 or .h1

PeterL said...

Quoted text here. Click to load it

h1{... } style for the <h1> element
.h1{... } style for any element that has the class of h1.
e.g. <p class="h1">. its a really dumb name for a class.

22/September/2003 07:55:48 pm

Re: h1 or .h1

On Mon, 22 Sep 2003 19:58:27 +1000, brucie

Quoted text here. Click to load it

I have seen pages where people do their headings this way.  Actually,
more likely to be <span class="h1">.  You are right that it is really
dumb.  Still, it makes me happy since, all else being equal, their pages
will end up ranked below mine by Google.

Greg Schmidt (gregs@trawna.com)
  Trawna Publications (http://www.trawna.com /)

Re: h1 or .h1

brucie wrote:
Quoted text here. Click to load it

Many thanks to all for the pointers folks,  Not sure I completely understand
but I'll study the specs more.



Petes Page

Jordanstown Schools website

Site Timeline