
Elementor text alignment not working? Trace the CSS conflict
- Wordpress
- November 19, 2026
Table of contents
A Text Editor widget on a WordPress site running Elementor Pro and the The7 theme appeared left-aligned until I clicked it to edit. The text then snapped back to the center. Changing the alignment in Elementor’s Style tab appeared to have no effect. The issue returned when switching from Text (HTML) to Visual mode and persisted after removing some HTML alignment attributes.
TinyMCE or the visual editor seemed like a plausible starting point. Firefox’s console showed warnings but no obvious JavaScript errors. The turning point came in Firefox Inspector, where disabling two text-align: center!important declarations restored the expected alignment. Both declarations came from custom CSS stored in Elementor’s page data.
Find the CSS overriding text alignment in Elementor
Open the page or preview where the text is centered. Press F12, open Inspector, and use the element picker to select the affected text. Check which HTML element Firefox highlights. If you land on a nested span or link, inspect its paragraph and the widget container as well. The alignment may be set on any of those elements or inherited from an ancestor.
In the Rules panel, look for text-align. Firefox shows which declaration applies and strikes through declarations that lose in the cascade. The link next to each rule identifies the stylesheet and line. In the Computed panel, you can see the effective value on the selected element and trace it back to the rule that supplies it.
In this case, the stylesheet contained rules like these:
.box-description, p {
text-align: center!important;
}
.box-description p {
text-align: center!important;
}
The comma in the first rule creates a list of independent selectors. The p branch therefore matches every paragraph in the document where the stylesheet applies, including paragraphs outside the widget.
| Selector | What it matches |
|---|---|
.box-description | Elements with that class. Their descendants can inherit the alignment. |
.box-description p | Paragraphs anywhere inside an element with that class. |
.box-description, p | Elements with the class and every paragraph, as two separate groups. |
An author declaration marked !important outranks a normal author declaration for the same property on the same element, even if the normal rule has a more specific selector. Among declarations with equal precedence, factors such as specificity and source order determine the winner. Inheritance is a separate part of the diagnosis. If Elementor sets alignment on the widget container and custom CSS sets it directly on the paragraph, the paragraph uses its own value before it considers inheriting one.
Hover over the winning declaration in Rules and clear the checkbox beside it. This changes only the page open in that browser. In this case, I had to disable both declarations before the text followed the expected alignment. A paragraph matching both selectors can stay centered after either one is disabled on its own.
Trace the generated post-ID.css file to its source
Firefox pointed to an Elementor stylesheet with a path like /wp-content/uploads/elementor/css/post-XXXXX.css. The number identifies the Elementor document that generated the stylesheet. On other sites, the source could be a template loaded on the page, so use the file identified by the Inspector when choosing which document to examine.
Elementor builds these stylesheets from saved settings. Editing the generated file leaves the original rule in place, so the next regeneration can bring it back. In this case, the CSS served by the site still contained the old rules after an initial database edit.
Requesting the CSS with a query parameter such as post-XXXXX.css?check=1 helped distinguish an older cached response from what the site was serving at a different URL. If the URL already has a query string, append &check=1. The result depends on the caching layers involved. The browser can reuse a local copy. A caching plugin can serve older HTML or a combined stylesheet. A CDN can serve its own copy and may ignore query parameters for certain assets. Comparing the responses helps with diagnosis. Regenerating the CSS addresses the file Elementor produces.
Find custom CSS in Elementor’s _elementor_data metadata
Elementor stores a document’s element structure and settings as JSON in WordPress post metadata. In this case, the _elementor_data value contained custom_css properties that I had been unable to locate at first in the editor. Searching for the class shown in Firefox led back to the saved rule.
In phpMyAdmin, select the correct database and open the SQL tab. Start with a read-only query. The IDs below are examples. Replace 12345 with the document ID and use the actual table name if your WordPress installation uses a prefix other than wp_.
SELECT meta_id, post_id, meta_key
FROM wp_postmeta
WHERE post_id = 12345
AND meta_key = '_elementor_data'
AND meta_value LIKE '%box-description%';
Use the returned meta_id in place of 123456 to examine a small part of the JSON around the class name:
SELECT meta_id,
LOCATE('box-description', meta_value) AS position,
SUBSTRING(
meta_value,
GREATEST(1, LOCATE('box-description', meta_value) - 100),
300
) AS context
FROM wp_postmeta
WHERE meta_id = 123456
AND post_id = 12345
AND meta_key = '_elementor_data'
AND LOCATE('box-description', meta_value) > 0;
LOCATE() returns the position of the first match, or zero if the string is absent. SUBSTRING() extracts a portion of the value around that offset. To look for further matches, pass a starting position beyond the current match as the third argument to LOCATE(). Examine the surrounding CSS and JSON to determine which element owns each rule and whether any match belongs to a component that should keep its current styling.
Count the exact !important declarations before editing
The first search for text-align: center !important returned no matches. The stored declaration was text-align: center!important;, with no space before !important. Both forms are valid CSS. A literal search still needs the spacing used in the saved data. If the full declaration yields nothing, start with a shorter string such as text-align, !important, or the class name and inspect the original formatting.
SELECT (
LENGTH(meta_value) -
LENGTH(REPLACE(meta_value, 'text-align: center!important;', ''))
) / LENGTH('text-align: center!important;') AS occurrences
FROM wp_postmeta
WHERE meta_id = 123456
AND post_id = 12345
AND meta_key = '_elementor_data';
Inside a SELECT, REPLACE() computes a copy of the value with the exact matches removed. Subtracting the shorter byte length from the original gives the number of bytes removed. Dividing by the byte length of the search string yields the number of exact matches. This query makes no database changes. It returned two in this case, consistent with the declarations found in Firefox. Read the context of both matches before deciding what to remove.
Remove the unwanted CSS from the identified Elementor record
The first edit changed .box-description, p { to .box-description {. This removed the generic paragraph selector, but the two declarations could still center text within the box, either through the container or directly on its paragraphs. Removing both declarations from Elementor’s data resolved the underlying conflict.
If you can find the custom CSS in Elementor, edit it there. Changing _elementor_data directly is an advanced procedure for a rule you have traced to a specific record when editing it through the interface is impractical.
Before running an UPDATE, back up the database and keep a copy of the original record. Verify the table, document ID, metadata ID, and metadata key. Review every match and close any open Elementor sessions for that document. Saving from a tab with stale settings can write the unwanted declarations back.
UPDATE wp_postmeta
SET meta_value = REPLACE(
meta_value,
'text-align: center!important;',
''
)
WHERE meta_id = 123456
AND post_id = 12345
AND meta_key = '_elementor_data';
Run this replacement only after confirming that every exact match in the record should be removed. The WHERE clause limits the write to the identified record. Within that record, REPLACE() affects every match regardless of which JSON property contains it. If a match belongs to another component and should remain, use a more targeted edit. Preview the result by running the same replacement expression in a SELECT and check that the resulting JSON is valid before writing. Afterward, read the record back and verify both the JSON and the remaining match count.
Regenerate Elementor’s CSS and verify the alignment
After editing the database, open Elementor → Tools in WordPress and choose Clear Files & Data or Regenerate CSS & Data, depending on the version. Some versions place Tools under Elementor → Editor. Elementor can then recreate the generated stylesheets from the updated settings. Elementor’s Clear Files & Data documentation.
Reload the page with Ctrl + Shift + R to bypass the browser’s local copy. If the site uses a caching plugin or CDN, check which stylesheet is returned in Firefox’s Network panel. Inspect the paragraph and widget container again and repeat the action that previously brought the problem back. After regeneration in this case, both declarations were gone and the widget’s alignment settings worked again.
Prevent future text alignment conflicts in Elementor
- Scope custom CSS to the component and check every branch of a comma-separated selector list.
- Use
!importantsparingly and check which elements receive a property directly or through inheritance. - Compare the rendered HTML, computed CSS and editor settings before adding another override.
- Edit the source of the rule and regenerate Elementor’s stylesheets.
- Back up WordPress before editing the database and limit the change to the record you have verified.
If a widget keeps ignoring its alignment settings, I can trace the conflicting rule and identify where it is stored through my WordPress support service.




















