Ability to remove ID's/classes, make HTML more clean

Well, i am not sure if this is even possible or if it would break things.
But why don’t we have the option to remove ID’s from blocks? I have no problem with it when they are generated automatically but why no option to delete them? Since they are not used for any styling, they are just sitting there doing nothing? When I just need a DIV I have an ID and a class sitting there for no reason which I can’t delete. Bricks is really close about clean code and this is a “feature” i would love to see. If it is not possible, I am curious about the reasons. Just a small addition related to clean HTML code.

1 Like

Hi Muhammad,

How do you style your elements if you don’t have IDs or classes? With inline styles?

The IDs and/or classes are used to uniquely identify and address the elements. Even unstyled elements have an ID or class because otherwise, it would be impossible to address them directly, let alone give them a default styling (which is the case for some elements).

I don’t know if you’ve worked with other page builders, but this is the case 100 times out of 100 - and for the reasons mentioned above, among others.

I hope that my answer can bring some light into the darkness.

Best regards,
timmse

1 Like

You really needn’t worry about the overhead of a few bytes from IDs added to all elements. Removing them isn’t going to make any significant difference.

Thanks for the addition Eric :+1:

Removing an ID is not ideal for a site builder to generate its outputs as you may face more issues then(more complaint about why and how).

For a website without an ID, It should be more suitable for you to handcode your site entirely.

2 Likes

@Silverlion009

If I remember correctly, LiveCanvas allows you to touch the html yourself. You can remove the classes and IDs too.

But I don’t like LiveCanvas.

2 Likes

How do you make a class that will override styling? (if you have the main style on an id).

For example let’s say i want to have a toggled side menu. if i would be able to remove id, i would style it with a class (let’s say “menu”) and then add another class of “open_menu” to let’s say change margin or translateX to reveal it (with an interaction that will toggle this class), but if i have an id with translateX set for example, it will override the class even when it is added.

Of corse i could just add a class “menu” but them why would i want the element to have an empty id and an extra class?

Hi! Just create a global-class, then move your styling on ID to the global class will do. Class styling is not possible to inherit ID’s styling.

1 Like