Solved

css alternate bgcolor li

Posted on 2007-03-28
2
323 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
2 Comments
 
LVL 30

Accepted Solution

by:
VirusMinus earned 500 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now