> **Source:** https://knowledge.leegality.com/document-execution/template/html-template/formatting-and-editing/margins-and-borders > **Site:** Leegality Knowledge Base — https://knowledge.leegality.com > **About:** Leegality is a document execution platform covering eSigning, stamps, NeSL, workflows, and REST API integration. > **Navigation:** Every article on this site has a plain-text version at `.txt` (this format). To get an index of all articles with their `.txt` links, read: https://knowledge.leegality.com/llms.txt > **AI Guide:** For instructions on how to navigate this knowledge base as an AI agent, read: https://knowledge.leegality.com/ai-readable.txt --- # Margins and Borders Margins and borders help you control the spacing and visual boundaries of your HTML template. Use margins to add space around your document content, and borders to create a professional frame for formal documents like certificates, letterheads, or official notices. ## Add margins Set custom margins to control the space around your document content: 1. In the HTML Template editor toolbar, click **Add Margin**. 2. A properties box will open with margin settings. 3. Adjust the margin values as needed: - **Top:** Space from the top edge of the page (in pixels) - **Bottom:** Space from the bottom edge of the page (in pixels) - **Left:** Space from the left edge of the page (in pixels) - **Right:** Space from the right edge of the page (in pixels) 4. Click **OK** to apply the margins. ### Default margin values - **Top:** 62 px - **Bottom:** 62 px - **Left:** 48 px - **Right:** 48 px > **Tip — Use Default Margins** > > The default margins (62px top/bottom, 48px left/right) are optimised for most standard documents and work well for printing. Only adjust if you have specific requirements. ### Reset to default margins To revert to the default values: 1. In the margin properties box, click **Reset to default**. 2. All margin values will be restored to their defaults (top/bottom: 62px, left/right: 48px). 3. Click **OK** to apply. > **Info — Print Considerations** > > Ensure margins are adequate for printing. Too small margins may result in content being cut off. If documents will be bound, increase the left margin (for left binding) or top margin (for top binding) to account for binding space. ## Add borders Add visual boundaries around your document to frame the content: 1. In the HTML Template editor toolbar, click **Add Border**. 2. The Border Properties box will open. 3. Configure the border settings: - **Thickness (px):** Enter the thickness of the border in pixels - **Distance from page edge (px):** Enter how far the border should be from the page edge in pixels - **Style:** Choose the border style - **Solid:** A continuous line (recommended for formal documents) - **Dotted:** A line made of dots (for decorative purposes) 4. Click **OK** to apply the border. > **Info — Distance from Page Edge** > > The "Distance from page edge" setting controls the gap between the page edge and where the border begins. Set appropriate distance (at least 10px) to ensure the border doesn't look cramped and prints properly. ## Edit margins or borders To modify existing margin or border settings: 1. Click the **Add Margin** or **Add Border** button again. 2. The properties box will open with current settings displayed. 3. Make your desired changes. 4. Click **OK** to save. > **Tip — Preview Your Changes** > > Always preview your document after adding or modifying margins and borders to ensure they appear as intended before finalizing your template. ## Preview margins and borders 1. Locate the **Preview** button in the bottom-left corner of the editor. 2. Click **Preview** to view how your template will appear with the applied margins and borders. 3. Check that margins provide adequate spacing and borders frame the content properly. 4. Exit preview mode and make any necessary adjustments. > **Tip** > > Always preview after setting margins and borders to ensure they work well together and look professional before finalizing your template. > **Info — NOTE** > > When using **[Source HTML](https://knowledge.leegality.com/document-execution/template/html-template/formatting-and-editing/source-html)** to merge 2-3 different templates together, it's critical to ensure all templates have consistent margin and border values before merging.