nth-of-type only working for 1 and 2

Posted by Owen O'Neill on Stack Overflow See other posts from Stack Overflow or by Owen O'Neill
Published on 2012-09-06T21:34:09Z Indexed on 2012/09/06 21:38 UTC
Read the original article Hit count: 189

Filed under:
|
|
|

I have a styling problem, I am using WordPress and want to do have the first two classes completely different to the others.

My ideal situation is to have:

.si-biplace:nth-of-type(3) { float:left; margin:20px 0px 0px 0px; }
.si-image:nth-of-type(3) { float:left; margin:20px 0px 0px 0px; border:0px; }
.si-title:nth-of-type(3) { width:100px; height:20px; margin:0px; font-size:7px; color:#FFFFFF; font-weight:bold; }

They seem to work fine when it is:

.si-biplace { float:left; margin:-10px 0px 0px 0px; }
.si-biplace:nth-of-type(2) { float:left; margin:-10px 0px 0px 15px; }

Is there a reason why it will not work with nth-of-type(3) but will with nth of type 2? I basically want different attributes for every next time the div is used but cannot have separate div classes as it runs through a php array.

© Stack Overflow or respective owner

Related posts about html

Related posts about css