How to Translate Divi and Bricks Builder HTML Layouts Without Losing Styles
Use lang to identify the translated content and translate="no" to protect names that must stay unchanged. This works for HTML in a Divi Code Module and for HTML prepared for conversion in Bricks, but neither attribute carries styles to the destination page. Keep the markup that your CSS targets, then verify the styling separately.
Start with one section you can compare before and after translation. In Divi, check both the Code Module and any CSS added to elements in the Visual Builder. In Bricks, check what the HTML and CSS converter created, then review any global styling data the destination site needs.
Translate the copy without changing the markup that styles it
Before editing, identify which parts of the HTML are copy and which parts are layout. A heading’s text can change without changing the heading level, its parent section, or the class names used by CSS. Set lang on the translated section if you’re localizing only that section; if the whole document is translated, set it on the document’s <html> element instead. Descendants inherit the language unless they declare a different one.
Source section
<section class="feature-panel" lang="en">
<div class="feature-copy">
<h2>Build a landing page with <span translate="no">Bricks</span></h2>
<p>Keep the same layout when you update the copy.</p>
</div>
</section>
The classes identify the section and its inner copy container independently of the wording. The translate="no" boundary covers only the product name, leaving the rest of the heading available for translation. If the section has images, review their text alternatives too: an alt value can be reader-facing copy even though it sits inside a tag.
Localized section
<section class="feature-panel" lang="fr">
<div class="feature-copy">
<h2>Créez une page de destination avec <span translate="no">Bricks</span></h2>
<p>Conservez la même mise en page lorsque vous modifiez le texte.</p>
</div>
</section>
The language declaration and reader-facing copy changed; the element hierarchy and class names did not. Compare both versions before pasting so you can catch a renamed class or a missing wrapper before it looks like a builder styling problem. The same markup and CSS can still wrap differently when the translated text is longer.
Never translate a class name to match the language of the page. A selector that targets the original name won’t match the renamed class.
Replace custom HTML in Divi and check CSS in both places
Divi’s Code Module accepts custom HTML and JavaScript, and the Visual Builder lets you add custom CSS to elements. Treat the markup you translate and the CSS you inspect as separate pieces. Updating a Code Module on an existing page is a different job from moving the layout to another site, where the destination may not have the same element-level CSS.
- Open the
Code Modulecontaining the source section. Record the outer wrapper and the classes used by the section and its children before editing the copy. - Check the module’s surrounding elements in the
Visual Builderfor custom CSS, especially if the HTML alone doesn’t account for the spacing you see. - Replace the reader-facing copy in the
Code Modulewhile preserving the wrappers and class names. If the module includes JavaScript, leave it untouched for the markup edit and review any embedded reader-facing strings separately. - On the destination page, verify the HTML and the element-level CSS independently. Don’t assume that having the same
Code Modulecontent proves the surrounding elements have the same styles.
Convert localized HTML and CSS into native Bricks elements
Open Bricks > Settings > Builder > HTML & CSS to Bricks. Choose Enabled (confirm on paste) if you want a prompt, or Enabled (no confirm on paste) if you don’t. With Disabled selected, the conversion feature isn’t active. If your CSS uses classes that Bricks needs to create globally, check that your role has the Create global classes permission.
Use the localized HTML with the CSS that targets it. The following CSS uses the same class names as both markup examples, so the translation doesn’t require a second set of selectors.
:root {
--feature-spacing: 2rem;
}
.feature-panel {
padding: var(--feature-spacing);
}
.feature-copy {
margin: 0;
line-height: 1.5;
}
Bricks can convert variables declared in :root into Global Variables and identify classes to create corresponding global classes. Margin, padding, and typography can map to builder controls; CSS properties without a dedicated control go into the element’s Custom CSS area. After pasting, inspect both places before deciding a declaration was dropped.
Inspect the native Bricks result before refining it
| Source | Bricks result to inspect | What to verify |
|---|---|---|
<section> and <div> | Section and Div | The inner Div still sits inside the Section so the classes apply at the intended levels. |
<h1> through <h6> | Heading | The localized heading retains the intended level, such as <h2>. |
<img> | Image | The destination displays the intended image and the rendered alt is appropriate. |
.feature-panel | Global class | The class is present and attached to the Section, not just listed in the class manager. |
:root | Global Variables | The imported spacing value is available where var(--feature-spacing) is used. |
The tag mappings describe the structure Bricks builds, not a guarantee that every source attribute survives conversion. Inspect the rendered HTML for lang and translate where you need them. Also check the finished page outside the editor: existing theme styles and CSS from the theme or plugins can change the result even when the converted structure is correct.
Transfer Bricks styling dependencies separately from the copy
For a move between Bricks sites, open Settings > Import / Export in the builder. Global Import / Export bundles selected global data in one ZIP. Select the layout data you need and the styling data it relies on, then review dependencies and conflicts on the destination before completing the import.
| Transfer route | Use it for | Destination check |
|---|---|---|
Settings > Import / Export | A ZIP of selected global data, such as templates, components, theme styles, classes, variables, palettes, breakpoints, and custom fonts | Review dependencies and conflicts. Confirm that site-specific resources, including images, are available. |
Theme Styles in Style Manager | Importing or exporting site-level defaults as JSON | Bricks skips a Theme Style if its ID already exists. Check the existing style instead of assuming the import replaced it. |
Global Class Manager | Importing or exporting classes apart from the full ZIP workflow | Check class IDs and names, breakpoint-specific Custom CSS, custom selectors, pseudo-state settings, and categories as relevant. |
A template or component can refer to classes, variables, or other components. If the destination layout looks right at one width but not another, compare the class’s breakpoint-specific rules before changing site-wide defaults. Theme Styles are defaults: global classes, page settings, element ID styles, and Custom CSS can override them.
Don’t sign off on a Bricks transfer until the destination resolves the layout’s dependencies. An imported template does not prove that its fonts, images, classes, and variables are all available.
Verify language, translation boundaries, and layout on the destination
Check the rendered page, not just the HTML you pasted. For example, if the whole page is French, the document should declare that language at the root; a product name that must remain unchanged needs only a narrow translation boundary.
<!doctype html>
<html lang="fr">
<head>
<title>Mise en page de la page de destination</title>
</head>
<body>
<section class="feature-panel">
<h2>Une page de destination avec <span translate="no">Bricks</span></h2>
</section>
</body>
</html>
This is a document-level inspection example, not a document to paste into a builder module. The heading inherits French from <html lang="fr">, and only the product name is excluded from translation. If only one section is French, use the section-level declaration from the earlier example instead.
Use HTML Translate to preview the localized fragment before comparing it with the destination builder’s rendered output.
- Inspect the localized
<h2>, paragraph text, and anyaltvalues, along with the scope oflangandtranslate="no". - Compare narrower and wider layouts. If the translated heading wraps differently, check the container width and typography before changing a shared
line-heightor spacing rule. - If spacing or typography differs even on short strings, inspect the applied styles. In Bricks, check the class,
Theme Styles, andCustom CSS; in Divi, compare theCode Modulemarkup with the element CSS in the Visual Builder.
Common translation and style-transfer problems
- The translated section lost its padding. Check that
class="feature-panel"is still on the outer section and that the matching rule exists on the destination. - The whole heading was skipped during translation. Move
translate="no"off the heading and onto the product-name<span>. - The translated copy still inherits the source language. Update
langat the narrowest scope that contains all the translated copy. - A Bricks style isn’t in the expected control. Check
Custom CSSfor declarations without dedicated controls, and confirm the class was created withCreate global classespermission if needed. - A Divi section looks right only on the source page. Compare the surrounding elements’ custom CSS in the
Visual Builder, not just the markup in theCode Module. - Importing Theme Styles didn’t change the destination. Check whether the
Theme Stylesimport skipped an existing ID, then check for class, page, element, or CSS overrides.
HTML File Translation Questions
Does changing lang translate the copy?
No. lang declares the language of an element’s content and text-containing attributes. Replace the source copy with the translated copy separately.
Can a product name stay unchanged inside a translated heading?
Yes. Put translate="no" on a wrapper around just the name. Keep the rest of the heading outside that wrapper so it remains eligible for translation.
Should you translate a Bricks class name for each language?
No. Keep a class such as feature-panel stable across localized versions when it serves the same styling purpose. Translate the content it styles, not the name the CSS matches.
Does Bricks put all converted CSS in builder controls?
No. Supported settings such as padding can map to controls, while properties without a dedicated control go into Custom CSS.
Can you use the same transfer workflow for Divi and Bricks?
Use the same markup comparison for both, but treat style transfer separately. Divi’s Code Module and Visual Builder are the places to check custom markup and element CSS; Bricks offers Settings > Import / Export for selected global data and an import review for dependencies and conflicts.