Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

css alternate bgcolor li

Posted on 2007-03-28
2
Medium Priority
?
336 Views
Last Modified: 2012-08-13
Hi all at EE,

I have a wysiwyg editor in a database backend that allows updating of text for the front end of my website.
My question is, is it possible for css, on the front end,  to automatically change the background color of any li to a certain color, and then have the next li another.. and repeat..
So in a sense alternating bgcolor for each li inside of a ul. I know how to do this in php for example but wondering if possible with css from what a user has entered into the database field which is displayed.

Can someone help me with this?
Thanks
Pauliostro
0
Comment
Question by:Pauliostro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 30

Accepted Solution

by:
VirusMinus earned 2000 total points
ID: 18806301
no, with plain CSS you cannot determine alternate elements in a html document.

you will either need to mark the alternating elements with a class when / before saving into the database

OR

using a javascript, when the document loads, traverse the DOM and pick out the alternate lists and alter their style attributes.
0
 

Author Comment

by:Pauliostro
ID: 18806638
Thanks, i'll research your options.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question