473,395 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

list style in order by even/odd number

I'm looking for the list <LI> style what change background-color in
condition of its number as even/odd type.

I think as
LI:list-number-status[even] { bla; }
LI:list-number-status[odd] { bla; }

What's the method to implement my idea?
Jul 20 '05 #1
6 13660
bohinta wrote on 23 sep 2003 in comp.infosystems.www.authoring.stylesheets:
I'm looking for the list <LI> style what change background-color in
condition of its number as even/odd type.

I think as
LI:list-number-status[even] { bla; }
LI:list-number-status[odd] { bla; }

What's the method to implement my idea?


<ul>
<li class=odd>
<li class=even>
<li class=odd>
<li class=odd value=23>depreciated!
<li class=even>
<li class=odd>
or a javascript method.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2
*bohinta* <va***@chol.com>:

I'm looking for the list <LI> style what change background-color in
condition of its number as even/odd type.


li:nth-child(odd) {background-color: bar}
li:nth-child(2n+1) {background-color: bar} /* same */
li:nth-child(even) {background-color: bar}
li:nth-child(2n) {background-color: bar} /* same */

That's CSS3: Selectors and thus probably nowhere implemented. Gecko has some
support for Selectors, but IIRC not for this part. For now one or two
classes is the best you can do.

--
"I didn't have the time to write a short letter, so I wrote a long one instead."
Mark Twain
Jul 20 '05 #3
In post <Xn*************************@216.168.3.30>
bohinta said...
I'm looking for the list <LI> style what change background-color in
condition of its number as even/odd type.


li,li+li+li,li+li+li+li+li,li+li+li+li+li+li+li,li +li+li+li+li+li+li+li+li{color:red;}
li+li,li+li+li+li,li+li+li+li+li+li,li+li+li+li+li +li+li+li,li+li+li+li+li+li+li+li+li+li{color:gree n;}

wow!

<ul>
<li>blah
<li>blah
<li>blah
<li>blah
<li>blah
<li>blah
<li>blah
<li>blah
<li>blah
<li>blah
</ul>

not supported by IE

--
23/September/2003 05:34:28 pm
Jul 20 '05 #4
brucie <br******@usenet.alt-html.org> wrote in
news:96***************@alt-html.org:
In post <Xn*************************@216.168.3.30>
bohinta said...
I'm looking for the list <LI> style what change
background-color in condition of its number as even/odd type.


li,li+li+li,li+li+li+li+li,li+li+li+li+li+li+li,li +li+li+li+li+li
+li+li+li{color:red;}
li+li,li+li+li+li,li+li+li+li+li+li,li+li+li+li+li +li+li+li,li+li
+li+li+li+li+li+li+li+li{color:green;}

wow!

<ul>
<li>blah
<li>blah
<li>blah
<li>blah
<li>blah
<li>blah
<li>blah
<li>blah
<li>blah
<li>blah
</ul>

not supported by IE


I like your approach, but is there a simpler way?

What happens if for example, you are styling a chapter in a bible
that runs between 30 to 50 verses?

I've always wanted to use alternate colors for each verse...but one
of the chapters run on to 176 verses!

At the moment, the html is

<ol>
<li id="b1c1v1"> (for book 1 chapter 1 verse 1)
<li id="b1c1v2"> (for book 2 chapter 1 verse 2)
<li id="bncnvn"> (for book n chapter n verse n)
</ol

I don't mind if not supported by IE

--
Kayode Okeyode
http://www.kayodeok.co.uk/weblog/
Jul 20 '05 #5
In post <Xn*************************@130.133.1.4>
kayodeok said...
What happens if for example, you are styling a chapter in a bible
that runs between 30 to 50 verses?

I've always wanted to use alternate colors for each verse...but one
of the chapters run on to 176 verses!


presumably you're sucking the text out of a database. use scripting to
add an odd/even class to the text as appropriate.

--
23/September/2003 06:32:14 pm
Jul 20 '05 #6
brucie <br******@usenet.alt-html.org> wrote in
news:1p****************@alt-html.org:
In post <Xn*************************@130.133.1.4>
kayodeok said...
What happens if for example, you are styling a chapter in a
bible that runs between 30 to 50 verses?

I've always wanted to use alternate colors for each verse...but
one of the chapters run on to 176 verses!


presumably you're sucking the text out of a database. use
scripting to add an odd/even class to the text as appropriate.


Actually, I found an out of copyright version at Project Gutenberg,
(http://www.gutenberg.org/) and cleaned it up using EditPlus' regex.

However, I will look into uploading into a database and using
scripting to manipulate it.

--
Kayode Okeyode
http://www.kayodeok.co.uk/weblog/
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: David MacQuigg | last post by:
I have what looks like a bug trying to generate new style classes with a factory function. class Animal(object): pass class Mammal(Animal): pass def newAnimal(bases=(Animal,), dict={}):...
8
by: RickMuller | last post by:
I have to sort a list, but in addition to the sorting, I need to compute a phase factor that is +1 if there is an even number of interchanges in the sort, and -1 if there is an odd number of...
5
by: Peter Collinson | last post by:
Hi... Is there any way to style a List Item a different color and size than the <LI> in an Ordered List? I'd like a red super-script number and a dark blue text in a page's footnotes. And...
11
by: mlf | last post by:
Is there a clever way, or any way for that matter, to have a nested list show 1.1, 1.2, 1.3...2.1, 2.2, etc?
5
by: Darryl B | last post by:
I can not get anywhere on this project I'm tryin to do. I'm not expecting any major help with this but any would be appreciated. The assignment is attached. The problem I'm having is trying to set...
33
by: Jim Cobban | last post by:
I cannot get Netscape 4.79 to properly display the ordered list in the following fragment. <P>Get a specific portion of the date. Depending upon the value of index: <ol start=0> <li>complete...
8
by: tom | last post by:
I am new to SQL administration. >From a list of IDs that are the primary key in one table (i.e. Customer Table), I want to make changes in tables that use those IDs as a foreign key. ...
144
by: Natt Serrasalmus | last post by:
After years of operating without any coding standards whatsoever, the company that I recently started working for has decided that it might be a good idea to have some. I'm involved in this...
4
by: JS | last post by:
I have a file called test.c. There I create a pointer to a pcb struct: struct pcb {   void *(*start_routine) (void *);   void *arg;   jmp_buf state;   int    stack; }; ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.