Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Button with SVG Icon

  • I would like to create this button with GB: https://prnt.sc/Ng4qxUzKj-aA

    But no matter what I try, I just can’t get it to work. The icon (I assign it to the top headline) always stays in the top area. But it should be centered next to the two lines.

    Can I generally do this with an svg icon? Or should I better create a GB container (instead of a button) and then assign the icon as an image?

    Thanks for a hint!

  • Hi there,

    Yes, with that layout, using a container is more granular. I’ve constructed an example structure for that layout. You can paste this inside the block editor to see the structure and customize it as needed.

    
    <!-- wp:generateblocks/container {"uniqueId":"cf52b22c","backgroundColor":"var(\u002d\u002daccent)","isDynamic":true,"blockVersion":4,"flexDirection":"row","sizing":{"width":"300px","height":"100px"},"spacing":{"paddingTop":"5px","paddingLeft":"5px","paddingRight":"5px","paddingBottom":"5px"}} -->
    <!-- wp:generateblocks/grid {"uniqueId":"c1147b75","columns":2,"isDynamic":true,"blockVersion":3} -->
    <!-- wp:generateblocks/container {"uniqueId":"a51988ff","isGrid":true,"gridId":"c1147b75","isDynamic":true,"blockVersion":4,"sizing":{"width":"25%","widthMobile":"100%"}} -->
    <!-- wp:generateblocks/headline {"uniqueId":"af03764d","blockVersion":3,"display":"flex","alignItems":"center","columnGap":"0.5em","spacing":{"paddingTop":"15px","paddingLeft":"15px","paddingRight":"15px","paddingBottom":"15px"},"hasIcon":true,"removeText":true,"iconStyles":{"height":"2em","width":"2em"}} -->
    <h2 class="gb-headline gb-headline-af03764d"><span class="gb-icon"><svg aria-hidden="true" role="img" height="1em" width="1em" viewBox="0 0 448 512" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M448 360V24c0-13.3-10.7-24-24-24H96C43 0 0 43 0 96v320c0 53 43 96 96 96h328c13.3 0 24-10.7 24-24v-16c0-7.5-3.5-14.3-8.9-18.7-4.2-15.4-4.2-59.3 0-74.7 5.4-4.3 8.9-11.1 8.9-18.6zM128 134c0-3.3 2.7-6 6-6h212c3.3 0 6 2.7 6 6v20c0 3.3-2.7 6-6 6H134c-3.3 0-6-2.7-6-6v-20zm0 64c0-3.3 2.7-6 6-6h212c3.3 0 6 2.7 6 6v20c0 3.3-2.7 6-6 6H134c-3.3 0-6-2.7-6-6v-20zm253.4 250H96c-17.7 0-32-14.3-32-32 0-17.6 14.4-32 32-32h285.4c-1.9 17.1-1.9 46.9 0 64z"></path></svg></span></h2>
    <!-- /wp:generateblocks/headline -->
    <!-- /wp:generateblocks/container -->
    
    <!-- wp:generateblocks/container {"uniqueId":"6a54fe3a","isGrid":true,"gridId":"c1147b75","isDynamic":true,"blockVersion":4,"sizing":{"width":"75%","widthMobile":"100%"},"spacing":{"marginTop":"","marginLeft":"","marginRight":"","marginBottom":"","paddingLeft":"30px","paddingBottom":"5px","paddingTop":"10px"}} -->
    <!-- wp:generateblocks/headline {"uniqueId":"8c3c07d7","blockVersion":3,"spacing":{"marginBottom":"0px"}} -->
    <h2 class="gb-headline gb-headline-8c3c07d7 gb-headline-text">Download</h2>
    <!-- /wp:generateblocks/headline -->
    
    <!-- wp:generateblocks/headline {"uniqueId":"9ac034b9","element":"p","blockVersion":3} -->
    <p class="gb-headline gb-headline-9ac034b9 gb-headline-text">(PDF, 1.4MB)</p>
    <!-- /wp:generateblocks/headline -->
    <!-- /wp:generateblocks/container -->
    <!-- /wp:generateblocks/grid -->
    <!-- /wp:generateblocks/container -->
    
  • Wow, what a service!

    Thank you very much, helps a lot 🙂

  • You’re welcome!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.