Give root element a class based on the tail's position