Modeling data with unknown number of features like web elements

Let’s say I want to model an object similar in nature to a web element. A web element can have infinite number of classes and the order of the classes is insignificant. How do I model this kind of data to use for inference with FastAI? For example, infer which element is clickable.

I could just use tabular data style and have 10 columns for classes (class0,class1… class2), but class order doesn’t matter, so which class it put in class0 or class1 is insignificant. Is there a better way?

I also want to model the element siblings, which can also have infinite amount and each sibling can have infinite amount of classes. Any idea how to approach this? Again in theory I can have sibling0_class0… sibling0_class1 for each sibling.

But I wander if there’s a better way. Some kind of vector-like modeling which you can have different sizes.