How To Add CSS Classes And ID Attributes In Divi 5

by | Oct 25, 2025 | Etcetera | 0 comments

In older variations of Divi, you’d to find separate fields within the Complex tab so as to add CSS IDs and Categories. In Divi 5, the ones fields are not there.

However not anything’s in reality lacking. The entirety moved into Attributes beneath the similar Complex tab. You’ll be able to nonetheless upload IDs and Categories precisely like earlier than, plus another customized attributes you wish to have. The adaptation is the way it’s arranged: one unified house as an alternative of scattered fields.

On this publish, we’ll stroll you thru including CSS categories and ID attributes the usage of Custom Attributes.

What Are Customized Attributes In Divi 5

Customized Attributes mean you can upload any HTML characteristic, like IDs, categories, ARIA labels, or information tags, immediately for your Divi components from the builder. It’s a solution to keep watch over how components behave, get styled, or get learn by means of browsers and assistive applied sciences.

In older Divi variations, you had devoted fields for CSS ID & Categories. They treated elementary styling wishes, however that’s all they might do.

CSS ID & Classes in older divi versions

Now, there’s a dropdown Attributes possibility within the Complex tab. Open it up and you’ll be able to upload any HTML characteristic to a piece, row, column, or module. IDs and categories nonetheless paintings the similar manner, however you’re not restricted to simply the ones two.

attributes option in new divi versions

Click on Upload Characteristic to open the panel the place you’ll be able to create, edit, or take away attributes. You’ll be able to select the kind of characteristic within the dropdown or manually input a customized characteristic.

See also  Find out how to Upload Social Media Icons in Your WordPress Sidebar

add attribute

Every characteristic wishes a Identify (identification, magnificence, aria-label, or data-info) and a Worth, similar to hero-section or button-large. You’ll be able to additionally upload an Admin Label to your personal reference and select a Goal Component to keep watch over whether or not the characteristic applies to the module itself or particular pieces within it.

Whenever you fill the ones in, Divi writes the characteristic immediately into the HTML. For instance, atmosphere the Characteristic Identify to identification and the Characteristic Worth to hero-section produces this:

<div identification="hero-section"></div>

Past IDs and categories, you’ll be able to upload accessibility attributes like aria-label, monitoring codes with data-*, or search engine marketing components like rel and identify. No use for third-party plugins or customized code snippets to make your website online extra out there or upload monitoring. You deal with it immediately within the builder, holding the whole lot in a single position whilst supplying you with higher keep watch over over how components paintings with CSS, JavaScript, and assistive applied sciences.

Why We Changed the CSS ID & Categories Possibility

Earlier than, CSS IDs and Categories sat in their very own separate fields. They labored high-quality, however including anything intended customized code or workarounds. Consolidating the whole lot into one Attributes panel method you’re now not searching thru other sections to use what you wish to have. You notice your whole attributes in a single spot, which makes managing them more practical and helps to keep your workflow constant.

For any person happy with HTML, this additionally feels extra herbal. You’re operating with attributes the best way they in reality exist in code, simply with out leaving the visible builder.

✅ Don’t Fear — Your Outdated IDs And Categories Are Nonetheless There ✅

Should you added IDs or categories in older Divi variations, you are going to now not lose them. Whilst you replace to Divi 5, the ones values are mapped into the brand new Attributes panel mechanically. Not anything is erased, and your entrance finish does now not alternate.

See also  How to Enable Auto Updates on Your WordPress Website

Right here’s what to understand:

  • The place to search out them: Open the component, pass to Complex > Attributes. You’ll see your previous entries indexed with Identify set to identification or magnificence.
  • Your CSS and JS nonetheless paintings: Any selectors that referenced the ones IDs or categories proceed to use with out edits.
  • Imports and Presets: Outdated layouts, Theme Builder templates, and international presets stay their IDs/categories. They seem within the Attributes record the instant you open them in Divi 5.
  • Fast take a look at: If styling appears off, ascertain the Goal Component is what you are expecting. Maximum components default to the module wrapper. In case your CSS was once geared toward an inside component, set the objective accordingly.

Learn Everything About Divi 5’s Custom Attributes

The use of Customized Attributes To Upload CSS Categories & ID Attributes

Including IDs and Categories in Divi 5 works the similar manner it at all times has. You’ll be able to practice them to any module, part, or row. Let’s stroll thru each.

Including An ID Characteristic

An ID goals one particular component on a web page. You’d use it for one thing that most effective seems as soon as, like the principle hero picture, a publication signup shape, or the footer touch part.

For this situation, we’ll label a picture because the hero picture of the web page.

id attribute example

Click on at the picture, pass to Complex > Attributes, and click on Upload Characteristic. Set the Characteristic Identify to identification and the Characteristic Worth to hero-image. Then choose Symbol because the Goal Component so the ID applies to the picture itself, now not the module wrapper.

declare id hero image

Save and preview the web page.

Should you check up on the component to your browser, you’ll see the ID connected to the picture within the HTML.

See also  Free vs Paid WordPress Themes: Pros and Cons for 2024

value assigned in backend

Including A Magnificence Characteristic

Not like an ID, a category will also be implemented to more than one components. This makes it helpful when you need the similar styling or habits throughout a number of pieces immediately, like your whole CTA buttons, testimonial playing cards, or pricing tables.

Right here, we’ll assign a category to each and every CTA button at the web page in order that they percentage the similar styling. Open the primary button, pass to Complex > Attributes, and set the Characteristic Identify to magnificence and the Characteristic Worth to cta-button.

CTA button class

Then repeat the similar steps for each and every button you need to incorporate within the cta-button magnificence.

adding same class to other buttons on page

As soon as the entire buttons percentage the similar magnificence, you’ll be able to taste them in combination the usage of the web page’s Complex > Customized CSS panel. Any adjustments you are making to that magnificence will practice to each and every button immediately.

Check out Customized Attributes In Divi 5 Lately

Customized Attributes don’t reinvent IDs and categories. They simply put the whole lot you wish to have in a single predictable spot. The Attributes panel helps to keep it arranged so that you don’t have to leap between fields or write workarounds to get issues finished.

Should you haven’t already, obtain the newest model of Divi 5 to start out the usage of Customized Attributes along side the entire different updates 👇🏻

The publish How To Add CSS Classes And ID Attributes In Divi 5 seemed first on Elegant Themes Blog.

WordPress Maintenance Plans | WordPress Hosting

read more

0 Comments

Submit a Comment

DON'T LET YOUR WEBSITE GET DESTROYED BY HACKERS!

Get your FREE copy of our Cyber Security for WordPress® whitepaper.

You'll also get exclusive access to discounts that are only found at the bottom of our WP CyberSec whitepaper.

You have Successfully Subscribed!