Site logo

Archived topic

How to add line/spacing between buttons

3 replies · Started by mamin on December 20, 2021

Viewing posts 1–4 of 4

Hi,

I added some link buttons into the Single Product Page using WC Hooks. I'd like to have some line spacing 1. between the two buttons, and 2. between the last button and the line prior to the product meta section. Tried adding <br> into the if statement below but doesn't seem to work.

Note: Buttons displayed may be 0/1/2 depending on url availability.

Code used in Elements:

<?php
    $url_platform1 = get_post_meta( get_the_ID(), 'url_platform1', true );
    $url_platform2 = get_post_meta( get_the_ID(), 'url_platform2', true );
    if ( $url_platform1 ) :
    ?>
        <a class="button" style="background-color:#FF6600" href="<?php echo $url_platform1; ?>" target="_blank">Buy It On Platform1</a>
			<?php
    endif;

    if ( $url_platform2 ) :
    ?>
        <a class="button" style="background-color:#0f1268" href="<?php echo $url_platform2; ?>" target="_blank">Buy It On Platform2</a>
			<?php
    endif;
?>

Link and code included for reference.

Thanks in advance.

Hi there,

You can try adding margin-bottom: 20px; style to the first button so there's spacing between the 2 buttons. :D

Works great. Thanks.

No problem. :D

This archived topic is closed to new replies.