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 7913697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:54:20+00:00 2026-06-03T13:54:20+00:00

If I have couple <div> s within a <td> , can I select each

  • 0

If I have couple <div>s within a <td>, can I select each one?

For example i want to make the first one float left and the second float right. is it possible using just CSS?

.divE:first-child { float:left; }
.divE:last-child  { float:right; }

HTML

<table id="myTbl" cellpadding="0" cellspacing="0">
    <tr>
        <td>
        <div class="red">asdasd</div>
        <div class="divE"></div>
        <div class="divE"></div>
        content
        </td>
    </tr>
</table>
  • 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-06-03T13:54:21+00:00Added an answer on June 3, 2026 at 1:54 pm

    Yes it is 🙂

    You can set the .divE class to float left by default, and then you can by using the adjacent sibling selector define, that when an div of the divE class immediately follows another div of the divE class, it should float right like this:

    .divE {
        float:left;
    }
    
    .divE + .divE {
        float: right !important;
    }
    

    But isn’t it easier just to give the divs an id each, and then set the floats to each? Or just apply a .floatRight or .floatLeft class to the divs, and then change the floats of these classes? In this way you could reuse the classes.

    If you changed your HTML to:

    <table id="myTbl" cellpadding="0" cellspacing="0">
    <tr>
        <td colspan="3" width="25%">
        <div class="red">asdasd</div>
        <div class="divE floatLeft"></div>
        <div class="divE floatRight"></div>
        content
        </td>
    </tr>
    

    And add CSS like this:

    .floatLeft {
    float: left;
    }
    
    .floatRight {
    float:right;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have couple of inline images within a div I can't get the div
I have a couple of div tags nested within each other and a few
I have a couple of div elements contained in one container div , and
I have couple of issues- the first constraint on select is loaded when reference
I have couple <a> within a parent div which will perform a specific action
I have a couple of problems with my container DIV. For one it is
I have a couple of links on my page (inside a <div id=theme-selector> )
I have a page with a couple of divs, sort of like this: <div
ok I have couple of .NET classes that I want to use in VBA.
My basic layout is a couple of divs within a div - http://jsfiddle.net/nxPhy/ -

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.