PDA

View Full Version : Basic CSS Question


RyRiggsy
03-06-2008, 09:45 PM
Hello, brand new to all of this so please bear with me...I am trying to edit/format two different pages in Dreamweaver. Whenever I make a change to something like the "line height" for instance, it changes the line height in the other page and completely throws all off all of my text. I guess I am wondering how to just format one page separately from others, without CSS applying those changes to all pages. Any help would be greatly appreciated. Thanks!

tux
03-07-2008, 05:49 AM
Hello RyRiggsy and welcome to the forums.

When asking a question it is always best to post your code and/or a link to your webpage if possible. That way it is easier for members to help.

I guess I am wondering how to just format one page separately from others, without CSS applying those changes to all pages.

I'm still learning CSS myself but your will have to apply a different class to the two different items in your page. Some thing like this.....

<div class="item1">

and on the other page....

<div class="item2">

I've used the div tag here but you use whatever tag you are using.

Then in your CSS file you can apply a different class to each....

.item1 {
your css: rules here;
}

.item2 {
your different css: rules here;
}

Hope this helps.

Regards, Paul

Cary
03-08-2008, 06:04 AM
Another approach is to give the body tag of a page an ID or class. So maybe you only want styling to affect p elements on the home page rather than all pages. You might use:

<body class="home">

And then the css might look like this:

body.home p {
line-height:1.5;
}

tux
03-08-2008, 12:42 PM
Thats a good idea Cary, hope it helps RyRiggsy.

Cary could you take a look at this post.......


http://www.dreamweaverclub.com/forum/showthread.php?t=27523

...... I'm still trying to get up to speed with CSS. I've done a little test image gallery, could you see if I'm doing it correctly or is there a better or more simpler way. The layout is how it needs to be on the site its for.

Thanks mate.

Regards, Paul