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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:44:01+00:00 2026-05-11T11:44:01+00:00

Float:right specified for a div inside a table cell seems to have no effect

  • 0

Float:right specified for a div inside a table cell seems to have no effect in IE. I have also tried text-align right, among other things, to align the layer contents to the right, but without success in IE 7.

CSS snippet:

.workloadcell {     background-color: #E6D7E9;     padding: 0px;     width: 14px;     height: 16px;     text-align: right; }  div.workload {     background-color: #E6D7E9;     text-align: right;     width: 14px;     float: right; } 

HTML snippet:

<td class='workloadcell'>     <div class='workload'>         1     </div> </td> 

Both the HTML and the CSS validate, and in Firefox the text aligns right, as it should. If you want to test the complete code by copy/pasting it, it’s here:

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'> <html>     <head>         <meta http-equiv='Content-Type' content='text/html;charset=iso-8859-1'>         <title>Table Test</title>         <style type='text/css'> td {     border: 1px solid black; }   .workloadcell {     background-color: #E6D7E9;     padding: 0px;     width: 14px;     height: 16px;     text-align: right; }    div.workload {     background-color: #E6D7E9;     text-align: right;     width: 14px;     float: right; } </style>     </head>    <body>         <table>             <tr>                 <td>                     &nbsp;                 </td>                 <td colspan='4'>                     <div>                         2008                     </div>                 </td>             </tr>             <tr>                 <td>                     &nbsp;                 </td>                 <td>                     <div>                         Q1                     </div>                 </td>                 <td>                     <div>                         Q2                     </div>                 </td>                 <td>                     <div>                         Q3                     </div>                 </td>                 <td>                     <div>                         Q4                     </div>                 </td>             </tr>             <tr>                 <td>                     workload forecast                 </td>                 <td class='workloadcell'>                     <div class='workload'>                         1                     </div>                 </td>                 <td class='workloadcell'>                     <div class='workload'>                         2                     </div>                 </td>                 <td class='workloadcell'>                     <div class='workload'>                         2                     </div>                 </td>                 <td class='workloadcell'>                     <div class='workload'>                         2                     </div>                 </td>             </tr>             <tr>                 <td>                     actual workload                 </td>                 <td class='workloadcell'>                     <div class='workload'>                         3                     </div>                 </td>                 <td class='workloadcell'>                     <div class='workload'>                         3                     </div>                 </td>                 <td class='workloadcell'>                     <div class='workload'>                         2                     </div>                 </td>                 <td class='workloadcell'>                     <div class='workload'>                         3                     </div>                 </td>                         </tr>         </table>     </body> </html> 

(I know that the CSS is are not optimal in the sense that the class declarations are repeated for several elements, but please don’t comment on this, if it is not relevant to the problem.)

  • 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. 2026-05-11T11:44:02+00:00Added an answer on May 11, 2026 at 11:44 am

    It should work the way you have it (or the way alexmeia suggests).

    But, (this being IE), the headers Q1, Q2, etc. are pushing the table columns wider than the 14 px you’ve requested.

    The columns are right justified within the 14px you’ve defined, but the divs are not moving to the right in IE. (The div is staying within the 14px defined for it even though the column is actually wider than 14px)

    To illustrate this, you can either make the width say 28px or change the color of one of the backgrounds to demonstrate the difference between the td and the div within in.

    .workloadcell {     background-color: #E6D7E9;     padding: 0px;     width: 14px;     height: 16px;     text-align: right; }  div.workload {     background-color: #E6EEE9;     text-align: right;     width: 14px;     float: right; } 

    The solution for IE is to either not define a width or to make it wide enough to accomodate the header.

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

Sidebar

Ask A Question

Stats

  • Questions 124k
  • Answers 124k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Are you running on OS 3.0? I saw the same… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer It looks like you need to register Apache::Session::Memcached with Apache::Session::Wrapper,… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer Use DATENAME or DATEPART: SELECT DATENAME(dw,GETDATE()) -- Friday SELECT DATEPART(dw,GETDATE())… May 12, 2026 at 1:19 am

Related Questions

I've tried finding an understandable answer to this, but given up. In order to
I am trying to create a horizontal menu with the elements represented by <span>
I'm using KML and the GGeoXml object to overlay some shapes on an embedded
I am working on a web app. One of the views has been divided

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.