943,808 Members | Top Members by Rank

Ad:
Sep 24th, 2009
0

TD formatting not showing up in IE7

Expand Post »
Hi all. I'm having a problem in that I can't get the table cell text OR the background to center in IE7. Works fine in Mozilla. Text-align is set to left on one of the contianing divs but that doesn't seem to affect it.

CSS
HTML and CSS Syntax (Toggle Plain Text)
  1. .browseCategoryImage {
  2. background: #FFF url( 'images/browsecategorybg.png' ) no-repeat center center;
  3. vertical-align:top;
  4. height: 200px;
  5. text-align:center;
  6. }

PHP
HTML and CSS Syntax (Toggle Plain Text)
  1. <?php if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
  2. mm_showMyFileName(__FILE__);
  3.  
  4. $iCol = 1;
  5. if( !isset( $categories_per_row )) {
  6. $categories_per_row = 3;
  7. }
  8. $cellwidth = intval( 100 / $categories_per_row );
  9.  
  10. if( empty( $categories )) {
  11. return; // Do nothing, if there are no child categories!
  12. }
  13. ?>
  14. <br/>
  15. <table width="100%" cellspacing="0" cellpadding="0">
  16. <?php
  17. foreach( $categories as $category ) {
  18. if ($iCol == 1) { // this is an indicator wether a row needs to be opened or not
  19. echo "<tr> \n";
  20. }
  21. ?>
  22.  
  23. <td class="browseCategoryImage" width="<?php echo $cellwidth ?>">
  24. <br />
  25.  
  26.  
  27.  
  28. <a class="browseCategoryTitle" title="<?php echo $category["category_name"] ?> " href="<?php $sess-> purl(URL."index.php?option=com_virtuemart&amp;page=shop.browse&amp;category_id=".$category["category_id"]) ?>">
  29. <?php
  30. if ( $category["category_thumb_image"] ) {
  31. echo ps_product::image_tag( $category["category_thumb_image"], "alt=\"".$category["category_name"]."\"", 0, "category");
  32. echo "<br /><br/>\n";
  33. }
  34. echo $category["category_name"];
  35. echo $category['number_of_products'];
  36. ?>
  37. </a><br/>
  38. </td>
  39.  
  40.  
  41. <?php
  42. // Do we need to close the current row now?
  43. if ($iCol == $categories_per_row) { // If the number of products per row has been reached
  44. echo "</tr> \n";
  45. $iCol = 1;
  46. }
  47. else {
  48. $iCol++;
  49. }
  50. }
  51. // Do we need a final closing row tag?
  52. if (sizeof( $categories ) < $categories_per_row) {
  53. echo "</tr>\n";
  54. }
  55. ?>
  56. </table>
Last edited by arrbug; Sep 24th, 2009 at 7:40 pm.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
arrbug is offline Offline
18 posts
since Jul 2005
Sep 26th, 2009
0

Re: TD formatting not showing up in IE7

- Alignment is not inherited from div to table. You need to apply the style to the td tags.

- The php script may be overriding the style.

- If there is any syntax error in the style, the entire style becomes invalid in some browsers. You have syntax errors, because you have attributes without parameters in the background style.

Wrong:

no-repeat

Right:

background-repeat="no-repeat"
Reputation Points: 730
Solved Threads: 181
Nearly a Senior Poster
MidiMagic is offline Offline
3,314 posts
since Jan 2007
Sep 27th, 2009
0

Re: TD formatting not showing up in IE7

Click to Expand / Collapse  Quote originally posted by MidiMagic ...
- Alignment is not inherited from div to table. You need to apply the style to the td tags.

- The php script may be overriding the style.

- If there is any syntax error in the style, the entire style becomes invalid in some browsers. You have syntax errors, because you have attributes without parameters in the background style.

Wrong:

no-repeat

Right:

background-repeat="no-repeat"
Sorry for interference, but you'll have to correct this!

There's nothing wrong with his shorthand background css statement:
background: #FFF url( 'images/browsecategorybg.png' ) no-repeat center center; In fact it is absolutely correct and how shorthand background statements work.
But, there is more than one error in your sugestion:
cite: background-repeat="no-repeat"
1. The "=" mark is not allowed as css property/value delimiter;
2. the (") quotation marks in the property value, neither.

This syntax is not allowed on html element inline style attribute declarations, either.
Last edited by Troy III; Sep 27th, 2009 at 10:30 am.
Reputation Points: 120
Solved Threads: 61
Posting Pro
Troy III is offline Offline
511 posts
since Jun 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: CSS Floating menu makes page jump to left only on certain pages
Next Thread in HTML and CSS Forum Timeline: Fetch File from Apache Alias





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC