Link to home
Create AccountLog in
Avatar of sharingsunshine
sharingsunshineFlag for United States of America

asked on

Reduce space between table rows

I am trying to get these two statements closer together but what I have tried isn't working.  Here is my php code.  This is being inserted in the WooCommerce checkout page.


add_action( 'woocommerce_review_order_before_shipping', 'shipping_details', 10, 0 );

function shipping_details() {

echo'

<tr><td style="background-color:tan;" colspan="2" "padding:1px;" "margin-bottom:5px;"><strong>Mail Innovations</strong> takes 7-10 business days</td></tr>

<tr><td style="background-color:tan;" colspan="2" "padding:1px;" "margin-top:5px;"><strong>Standard</strong> takes 3-5 business days</td></tr>';

 }

Please show me how to reduce the space between the two rows.

User generated image


ASKER CERTIFIED SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
For better maintenance and readability, I suggest you extract the css and use classes.

You were missing some <strong> and </strong> too
Instead of echoing you can just end the php with a ?> before the HTML and start it with <? after (assuming short tags)
If your do not need the semantic effect of the strong, you can move that to the css too.

The cells will not change margins, you need divs or other block elements to do that:


<style>
.tanboldcell { 
  background-color:tan;
  font-weight: bold;
  padding:1px;
}
.marginbot { margin-bottom:5px; }
.margintop { margin-top:5px; }
</style>
.....
?>
    <tr>
      <td class="tanboldcell" colspan="2">
        <div class="marginbot">takes 7-10 business days</div>
      </td>
    </tr>
    <tr>
      <td class="tanboldcell" colspan="2">
        <div class="margintop">Standard takes 3-5 business days</div>
      </td>
    </tr>
<?

Open in new window