Skip to content Skip to sidebar Skip to footer

Alternate Div To Have Images Left(even) Or Right(odd)

I am trying have a better arrangement of images instead of just images in 1 column. See example in attachment, the images for each article can be on left and right. This is my co

Solution 1:

Try using this css

.list_page article:nth-child(odd) .list_img{ 
    float:right; 
}
.list_page article:nth-child(even) .list_img{
     float:left;
}

Problem is you selecting the parent div not the child article


Solution 2:

Your code will work if you select the article

<style>

article:nth-child(odd) .list_img{ 
    float:right; 
}
article:nth-child(even) .list_img{
     float:left;
}
</style>

Solution 3:

Hi you use bad selector for odd and even. No ".list_page" but "article" tag

article:nth-child(odd) .list_img{ 
    float:right; 
}
article:nth-child(even) .list_img{
     float:left;
}

http://jsfiddle.net/mraranturnik/3u64jaew/


Post a Comment for "Alternate Div To Have Images Left(even) Or Right(odd)"