SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
Thread: fixed width cells?
-
Nov 9, 2006, 02:15 #1
- Join Date
- Jan 2006
- Location
- south london
- Posts
- 187
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
fixed width cells?
hi guys
can anyone tell me how to do fixed width cells, i have width="33%" but when i put in a bigger picture the cell expands which is not what i want as i have 3 cells.
code is:
<td width="33%">
<img src="img/metal-balls.jpg" />
<p>Text</p>
</td>
<td width="34%"> 
</td>
<td width="33%"> 
</td>
thanks in advance
-
Nov 9, 2006, 02:47 #2
- Join Date
- May 2006
- Location
- Aurora, Illinois
- Posts
- 15,476
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Rather than using a relative unit such as a percentage, try using an absolute unit such as pixels for your table cells.
Or better yet, declare an absolute width for the table element itself.Save the Internet - Use Opera | May my mother rest in peace: 1943-2009
Dan Schulz - Design Team Advisor | Follow me on Twitter
SitePoint References: HTML CSS JavaScript | Become A Guru
WordPress SEO Checklist | What WordPress Plugins Do You Use?
Web Standards Curriculum | Image Free Equal Height Columns
-
Nov 9, 2006, 03:28 #3
- Join Date
- Dec 2004
- Location
- Derbyshire - UK
- Posts
- 2,651
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Alternatively you could place the image in the cell using a background image.
Code:<td style="width: 33%; background-image: url(img/metal-balls.jpg); background-repeat: no-repeat;"> <p>Text</p> </td> <td style="width: 33%;">  </td> <td style="width: 33%;">  </td>
Obviously you should also be doing this in an external CSS file but this should serve to demonstrate how this could work.
-
Nov 9, 2006, 04:18 #4
- Join Date
- Nov 2004
- Location
- Ankh-Morpork
- Posts
- 12,158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Table cells will normally expand to accommodate their content. Cell widths are more like min-width.
You may be able to achieve the desired result by playing with table-layout:fixed for the table and overflow for the cells.Birnam wood is come to Dunsinane
Bookmarks