Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 23rd, 2007, 11:00 AM
Registered User
 
Join Date: Nov 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to force table cell to a certain width?

Hello,

 i have made a table that has two rows, the second row has one cell which contains dynamic conents generated in asp .net, the first row has three columns:

- the centered one contains the table title and background image

- the left has a background image that for the left edge and so the right cell

the left and the right background images have with =9px so i changed the width in my style sheet page of the two cells to 9px and left the middle cell to auto

unfortunetly the size of the two cells (left and right are not 9px) how to force the width of them to 9?

this is the table html code:

<table border="0" width=100% cellspacing="0" cellpadding="0" id="table1">
 <tr>
  <td class="left" ></td>
  <td class="center" >TITLE</td>
  <td class="right" ></td>
 </tr>
 <tr>
  <td colspan="3">Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed
  Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed
  Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed
  Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed
  Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed
  Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed
  Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed
  Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed
  Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed
  Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed
  Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed
  Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed
  Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed
  Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed
  Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed
  Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed
  Ahmed Ahmed Ahmed Ahmed Ahmed Ahmed </td>
 </tr>
</table>



and this is the style code:

<style>
.left{
background: url('http://img294.imageshack.us/img294/9014/smallheaderleftdr6.gif'); width:9px;
}
.right
{
background: url('http://img294.imageshack.us/img294/6783/smallheaderrightmq2.gif'); width:9px
}
.center
{
background: url('http://img150.imageshack.us/img150/4071/smallheadercenterun4.gif');
}

</style>




 
Old April 17th, 2007, 01:57 PM
Registered User
 
Join Date: Apr 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I assume your cells are not as wide as 9px?

In previous tables I've created where a cell is used only for a background image, I had to use a non-breaking space to populate the cells. This forced the cells to expand to the proper width. Cells with no foreground elements tend to collapse.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Table: width setting for a cell Venki XSLT 2 July 14th, 2008 09:05 AM
table width auto mateenmohd Classic ASP Basics 2 May 25th, 2007 09:46 AM
table width auto mateenmohd HTML Code Clinic 1 May 24th, 2007 08:54 AM
Force somthing invisble into table cell jacob HTML Code Clinic 1 October 30th, 2005 03:00 PM
Table adjusting its own width mahulda General .NET 3 August 5th, 2004 04:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.