Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,256
Total Threads: 81,169
Total Posts: 566,839
There are 41 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     HTML/XHTML/DHTML/CSS :

nth-of-type problem.

Thread title: nth-of-type problem.
Reply    
    Thread tools Search this thread Display Modes  
03-19-2012, 01:52 AM
#1
Dan is offline Dan
Dan's Avatar
Status: Request a custom title
Join date: Feb 2005
Location:
Expertise:
Software:
 
Posts: 3,164
iTrader: 15 / 86%
 

Dan is an unknown quantity at this point

  Old  nth-of-type problem.

I'm wanting to style every other 3 items. Is there a better solution than my hacked together code? It feels dirty.

Code:
li:nth-of-type(6n+2), li:nth-of-type(6n+1), li:nth-of-type(6n+3)

03-24-2012, 12:43 AM
#2
Choco is offline Choco
Status: Member
Join date: Jul 2007
Location: USA
Expertise:
Software:
 
Posts: 240
iTrader: 2 / 100%
 

Choco is on a distinguished road

Send a message via MSN to Choco

  Old

I'm pretty sure that's the only way to do it. There's no way to select groups of elements (in your case, groups of 3) and then alternate with something like an nth-of-type(odd) selector.

03-24-2012, 06:46 PM
#3
derek lapp is offline derek lapp
Status: design rockstar
Join date: Jan 2005
Location: guelph, ontario
Expertise:
Software:
 
Posts: 2,246
iTrader: 0 / 0%
 

derek lapp is on a distinguished road

  Old

i think you'll need to use either javascript or php with a $counter variable and the % operator in something like php if you have to accommodate lame, older browsers.

http://api.jquery.com/nth-child-selector/

04-07-2012, 12:20 AM
#4
shakemelikeapig is offline shakemelikeapig
Status: On Vacation
Join date: Dec 2009
Location:
Expertise:
Software:
 
Posts: 70
iTrader: 0 / 0%
 

shakemelikeapig is on a distinguished road

  Old

I'm not exactly sure what you want to do here, but there are many different ways to do this. Are you using php or is this in a template of another script?

Reply With Quote
Reply    


Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed