h1 or .h1

P

PeterL

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

PeterL
 
M

Matthias Gutfeldt

PeterL said:
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.

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">.

Any theories appreciated.

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


Matthias
 
B

brucie

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

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.
 
G

Greg Schmidt

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.

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.
 
P

PeterL

brucie said:
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.



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

PeterL

--
========================================

Petes Page
http://leach01.co.uk

Jordanstown Schools website
http://jord.org.uk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,207
Latest member
HelenaCani

Latest Threads

Top