SOLVED IN 1.4: How to assign class or attribute to <img> tag?

@thomas What about id and classes? To which element will they apply? And what if we remove a property that previously enabled wrapper?

Thank you @thomas ,
i like that approach a lot! looking forward to see it live soon :slight_smile:

The element ID (#brxe-{unique_element_id}) and element class (.brxe-{unique_element_id}) is applied to the outermost HTML tag.

Builder: HTML tag set to picture & link to lightbox + image overlay:


Frontend: Image element HTML output (picture wrapper automatically added as needed):

2 Likes

Conditional image wrapper meansā€¦?

Meaning the figure, or picture, etc. wrapper around the img HTML tag is automatically added as needed. I provided an example for this use case with the screenshots I added in my reply.

When the img tag doesnā€™t need a wrapper (e.g. no image has no caption, overlay, etc.) then only the img tag without any ā€œwrapperā€ is rendered like this:

3 Likes

Ahā€¦I see. Itā€™s what I was thinking. Thatā€™s great!

Thanks @thomas :blush:

1 Like

Sounds like the smartest move for now, thanks a lot :slight_smile:

By the way, I canā€™t get overlay to work on image elementā€¦
Am I missing something? Is it not yet implemented?

Yep, thatā€™s a bug in 1.4-beta :wink: Will be fixed in the stable release. Already works for me locally.

2 Likes

@thomas Can we do this for all other elements too? If it does not add a lot of complexity. Like I get a clean <h 3> with no ids or no classes until I use any bricks option or styling.

image

3 Likes

To implement this properly takes quite a lot of additional logic & testing. But feel free to submit it via the idea board (https://bricksbuilder.io/ideas) and we might be able to look into it at the next HTML optimization stage.

5 Likes