View Full Version : semantics question

08-09-2010, 01:35 AM
Hi folks,

I am getting into the real nitty gritty of semantics with a mix of OCD, perhaps but I need to keep CSS simple as possible.

Do you assign a class to your H1 tags or do you have multiple classes for the container? I should point out that, I have many pages using the main_content div but the positioning of the H1 is different, either left, or centered or something else. I wonder if I should keep main_content standard and assign a second class or should I have many different h1 tags on the css. Maybe I shuld keep the basic tags standard across all pages but put the specifics for each in thier own class - a bit like a 1:many relationship in MySQL?

<div id="main_content a_class_here">
<h1>header text here:</h1>


08-09-2010, 01:39 AM
Alot of coders specify how they want their h1 h2 and h3 tags too appear. maybe you should do the same.

08-09-2010, 04:09 AM
yeh thanks for the reply but, the h1 will be semantically necessary on each page but, it layout/font/structure, may be different.

what I want to know is, should suhc changes be stored in the individual h1 or in the secondary css tag, associated with the main declaration i.e. the a_class_here tag?


08-09-2010, 04:19 AM
Only the common things should be stored in the first class. If you need to change its position on each page you could add the second class or an id as you will probably only have one h1 on the page. You could even assign an id or class to the body element and style the headers that way.

08-09-2010, 04:27 AM
You could even assign an id or class to the body element and style the headers that way.

whoop, you mean something like

body #main_content h1.new_class


08-09-2010, 01:04 PM
No not quite. I said add it to the body element. Each page would have a different ID or class. It can even be generated dynamically according to whatever page you are on. Then you just style it that way.