hi i need some help. Suppose i have 4 different xhtml pages(page1,page2,page3,page4), and all the 4 contain one <h1> tag.
Now i have an external css file and it contains(showing only h1 tag):

h1{font-size:16px;font-weight:bold;}

But now i want to add margin-top:10px(only for <h1> tag) for page1,page3 and page 4.if i add it in my css file like this

h1{font-size:16px;font-weight:bold;margin-top:10px;}

page2 also will be changed but i dont want this to happen. Any idea how i can do it?

You can use a Class, so it would be <h1 class = "marginClass" > Content </h1> and the CSS would look like:

h1{
    font-size: 16px;
    font-weight: bold;
}

.marginClass{
    margin-top: 10px;
}

You would then add the class section only when you wanted the tag to have the margin (pages 1, 3 and 4).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.