Code 

Droip offers extensive customization options, but there are times when you may require additional custom blocks of code. That’s where the Code element comes in handy.

Using this element, you can easily add code in the form of HTML, CSS, and Javascript to your page. And not only can you use this to add custom code but also to embed third-party elements like Bootstrap Components, Social Buttons, Maps, and more.

Adding the Code Element

To add the Code element, follow these steps:

  1. Open the Elements panel.
  2. Scroll down to the Components section.
  3. Drag & drop the Code element onto your canvas.

Custom Code Editor

To open the custom code editor, click on the button at its center or the ellipsis icon on its inline editor. On the resulting pop-up window, you’ll find two tabs — Code and Web URL.

Code Tab

Droip code tab

This is the custom code editor. Here, you can directly paste your HTML, CSS, and JS code and then simply click on the Embed button to save.

Web URL Tab

Web URL tab of Droip

Here, instead of typing in the full code, you can instead paste the URL where the block of code you want to add is written. To do that:

  1. In the same pop-up window, switch to the Web URL tab.
  2. Instead of typing the full code, paste the URL where the desired code is hosted. Please ensure the code is publicly accessible on the web.

How to Embed Custom Code

Follow these steps to embed custom code:

Step 1: Copy the Custom Code

Start by copying the custom code you want to embed, either from your own code editor or a third-party resource. For example, consider the following HTML table:

<table>
    <tr>
        <th>User</th>
        <th>Country</th>
        <th>Email</th>
    </tr>
    <tr>
        <td>Tessa H.</td>
        <td>California, USA</td>
        <td>[email protected]</td>
    </tr>
    <tr>
        <td>Elend V.</td>
        <td>Scotland, UK</td>
        <td>[email protected]</td>
    </tr>
</table>

Step 2: Add the Code Element 

  1. Go to the Elements Panel.
  2. Drag and drop the Code element onto your page.

Step 3: Paste the Custom Code 

  1. Click on the ellipsis icon in the Code element.
  2. Switch to the Code tab.
  3. Paste the copied code here.

Step 4: Save Your Actions

Finally, click the Embed button to save the custom code.

Bonus: Adding Style

You can also Style this element by copying the Style code and going to the Pages Panel. Then, click on the ellipsis icon that’s beside the current page’s label. Select Settings and navigate to Custom Code. Paste the copied style code into the Inside <head> Tag section.

To apply styles to the Code element, follow these additional steps:

  1. Copy the style code.
  2. Go to the Pages Panel.
  3. Click on the ellipsis icon beside the current page’s label.
  4. Select Settings and navigate to Custom Code.
  5. Paste the copied style code into the Inside <head> Tag section.
  6. Save your changes.

Once it’s saved, you’ll be able to see the end result by clicking on the preview button on the top right.

Remember to exclude <html><body>, or <head> tags in your custom code, as they may interfere with the native code of the page and cause issues.

💡Tip: You can easily reuse custom code blocks by converting them into reusable elements using Symbols.

Was this article helpful?

Our website uses cookies to improve your browsing experience on our website. By continuing to use this website, you agree to their use. For details, please check our Privacy Policy.