John wrote:
[snip]
 > This has been an excellent thing for me to learn in my
 > greenhorn-hood..
 >
 > As I adjust my pages to work with this new combined style sheet, I'm
 >  adding "id="index" to every instance of my <p> tags; my "space
 > after" design employs a <p>paragraph's worth of text</p>
 > <p>paragraph's worth of text</p>, so every <p> needs adjusting.
 >
 > Is there a way to say "All of these <p> are now <p id="index">?"
[snip]

Hi John,

Id's are kinda like database indexes, and they must be unique (like a 
primary key). Your choices are to ignore this and do it anyway (the 
glory and freedom of the internet); change to class="index"; or add an 
auto incrementing value to the id: id="index1",id="index2",id="index3".

If it was me, I'd change them to classes and then use a Javascript 
function to change any non-index-class <p>s into <p class="index"> with 
a little javascript like this:

var convertParasToIndexParas = function () {
   var allParas = document.getElementsByTagName("P"),
       i = allParas.length;
   while (i--) {
     if (allParas[i].className.indexOf("index")<1) {
       allParas[i].className = allParas[i].className + " index";
     }
   };
};
window.onload=convertParasToIndexParas;

Ideally, the window.onload function should be routed through an Event 
Manager (google:addEvent). I like Dean Edwards' solution for this.

Anyway, then, style away in your style sheet like so:
p{
   background: #ffffe1;
   border: 1px solid #ccc;
   margin-top: 0;
   padding: 2px 5px;}

Hope it helps!
Bill Brown
TheHolierGrail.com

______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to