Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 844987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:22:25+00:00 2026-05-15T06:22:25+00:00

Basically, what I’m trying to create is a page of div tags, each has

  • 0

Basically, what I’m trying to create is a page of div tags, each has an image inside them and I’m trying to use CSS3’s nth-child to alternate the float of that specific image.
But for the life of me, I can’t get the nth-child to locate those images. Here is my code so far…

CSS

.featureBlock img:nth-of-type(even) {
    float: left;
}

.featureBlock img:nth-of-type(odd) {
    float: right;
}

This is the HTML of one of those div tags….

    <div class="featureBlock">

        <h1>Multisize Players</h1>

        <div class="featureHelpBlock"><a href="#">More help with this</a></div>

        <img src="http://office2.vzaar.com/images/features/ft_multisize_players.png">

        <span class="featureContent">
            <p>A variety of player sizes is important as we recognise the fact that no two videos or websites are ever the same and you will want something that suits your site&#8217;s look. So if you record your video in 4x3 (not widescreen) or 16x9 (widescreen) we have the range of player sizes to suit your exact needs.</p>

            <p>We encode the video at the time of uploading in the size that you choose so that the picture and sound quality is retained throughout. Users can choose from the following sizes:</p>
        </span> 
        <br style="clear:both"> 

    </div>

Hope this makes sense.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T06:22:26+00:00Added an answer on May 15, 2026 at 6:22 am

    Assuming you have several elements with the class featureBlock inside the same parent element, you would want to do this instead:

    .featureBlock:nth-of-type(even) img {
        float: left;
    }
    
    .featureBlock:nth-of-type(odd) img {
        float: right;
    }
    

    See it in action on jsFiddle: http://jsfiddle.net/PZWd6/

    The SitePoint CSS reference says of nth-of-type:

    This pseudo-class matches elements on
    the basis of their positions within a
    parent element’s list of child
    elements of the same type.

    You can read more about it at the sitepoint reference page:
    http://reference.sitepoint.com/css/pseudoclass-nthoftype

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I am trying to restart a service from a php web page. Here
Basically I am trying to search the page when it loads for the string
Basically I want to check the extended permissions the user has granted my app.
Basically what I'm trying to do is make a very simple vertical bullet projectile
Basically, I have a main page (parent page) with a link that opens up
Basically I have an IFRAME that contains a given page - I want to
Basically, I would like a page that consist of a slideshow that contains a
Basically, each time I click on a graphicsview, I'd like a new QGraphicsEllipseItem to
Basically I'm trying to improve on the Ghosts in a Pacman game I'm making.
Basically i'm trying to build a comment system. The user looks at a photo

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.