how to fix the width of td element to 50%?

Hi,

I need to fix the width of a td element. I have used <td style="width:50%; min-width:50%;"></td>
but the width is not 50%. How can I accomplish this task.

Thanks,
vielkacarolina1239Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pratima PharandeCommented:
try this

<table width="50%" border="1"  >
      <tr><td style="width:50%" >1</td>
      </tr>
      </table>
0
SreejithGCommented:
Use width="50%". It will set to 50% of the table width.
<TABLE cellSpacing=1 cellPadding=1 width="100%" border=1>
  <TR>
    <TD width=50%>1</TD>
    <TD>1</TD>
  </TR>
  <TR>
    <TD>1</TD>
    <TD>1</TD>
  </TR>
  <TR>
    <TD>1</TD>
    <TD>1</TD>
  </TR>
 </TABLE>

Open in new window

0
scrathcyboyCommented:
You can't use relative % widths this way in tables like you can in DIVs and tableless layout.  If you specify the width of the TABLE as a fixed value, like 500 px, then you can use TD width 50%, but that is the same as giving it 250px fixed.  If the table is percent width, and the TDs are also percents, they will only adjust to the width of the data in them, they will not CUT OFF or force wrap data in the TDs.  You need to be using DIVs and SPANs for what you want -- an absolute width, no matter what the length of the data in it.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.