css ?
- Started
- Last post
- 25 Responses
- lobstarr0
that's it that's all
- matt310
i haven't read anything above but use classes. also you don't need the UL id for the coloring:
<ul>
<li class="red">content 1</li>
<li class="white">content 2</li>
<li class="black>content 3</li>
</ul>styles are:
.red {
background-color: #c00;
padding: 5px; (might want to pad it out a bit)
}.white {
background-color: #fff;
padding: 5px;
}.black {
background-color: #000;
padding: 5px;
}that's it that's all.
- maybe you should have read everything aboveflyingnowhere
- hahajsaul
- hahamoth
- garymatt31
- D_Dot0
Is it always a set amount of li elements? or is that ever changing as well? Take a look at this nav (which is what I assume you are doing)
http://www.realmacsoftware.com/r…
The first <li> element has a bg image, that you could make any colors you want, then just make sure the following <li> elements are set to the same width.- http://www.realmacso…
D_Dot - minus the text of course...D_Dot
- its not navigation like that, it's floating elements with a photo and text within, 3 rows of 3flyingnowhere
- lol carry on then.D_Dot
- http://www.realmacso…
- flyingnowhere0
so i think im just going to use Stugoo's option
#idname li{background-color:red; }
#idname li+li{background-color:blue; }
#idname li+li+li{background-color:green; }and say to hell with ie6 users
- thanks for the help everyone!flyingnowhere
- if you can add jquery, my script will cater for ie6rafalski
- cbass990
this is what I do to get that effect:
<li><a href="index.html"style="color: #93b9bf">HOME</a></li>
- rafalski0
Hahaha moth.. In ideal world, Stugoo's CSS would do. In order to be IE6 compliant, I'd place the styles for IE6 in jQuery. Something lin the lines of:
$(function(){
$("ul#idname>li:eq(1)").css("bac...
$("ul#idname>li:eq(2)").css("bac...
})
- moth0
Some day soon....
http://www.zorked.com/css/altern…
- amullins0
css3 (works for safari):
ul#idname li:nth-child(odd) { background-color: #cccccc; }
- flyingnowhere0
D_Dot
using a background like that, wouldn't i have to set the background-position as a different integer for each <li>?
- therefore, creating the same issue i have nowflyingnowhere
- moth0
Using javascript/jquery for this is a preposterous idea and makes me think this amatuer week.
What's generating your code flyingnowhere?
- some ruby script, which i cannot change because it is being used in many other placesflyingnowhere
- the only thing i can change is the cssflyingnowhere
- excuse me for trying to help! he said he can't generate the code so you have to improvise.amullins
- It's always amateur week on qbn when it comes to coding questionsmhr
- Stugoo0
and if JS is disabled? will it work?
- amullins0
for css you'd need to output a className for each li on the server side
js solution:
http://76.12.164.165/temp.htm- this exmaple uses jquery. it could be easily done without a lib.amullins
- i get that, but it's not an optionflyingnowhere
- flyingnowhere0
they are generated through ruby script, i cannot change that script because many other sites are using it
- zenmasterfoo0
how are you dynamically generating the list items? Is this Java? If so you should be able to modify each id for whatever css values you want.
- heavyt0
i'd agree with the javascript route. Easiest solution available
- D_Dot0
- thats also a good idea.Stugoo
- fixed bg -position?flyingnowhere
- jonatne0
javascript
- Stugoo0
have a look at this...
http://stugoo.co.uk/testbed/list…however you should be able to use the row number or the output id to create a class specific using the language thats being dynamically created..
- mistermik0
ask skt
- bulletfactory0
might be able to wrap the li content in a span with a class name