lundi 13 juin 2016

Add element to Less CSS rule

I am trying to set the display style of different elements based on their type, while matching a set of rules using less.

Using "&" after the rules have been defined appends the element type to the end of the rule and either with or without a space this is obviously not working.

I am sure there is a less repetitive, more optimal way to write the following:

&.admin{
            .service_provider.security_class_admin,
            .service_provider.security_class_admin_manager,
            .service_provider.security_class_admin_user,
            .service_provider.security_class_admin_manager_user{
                display: block;
            }
            th{
                &.service_provider.security_class_admin,
                &.service_provider.security_class_admin_manager,
                &.service_provider.security_class_admin_user,
                &.service_provider.security_class_admin_manager_user{
                        display: table-cell;
                }
            }
            button{
                &.service_provider.security_class_admin,
                &.service_provider.security_class_admin_manager,
                &.service_provider.security_class_admin_user,
                &.service_provider.security_class_admin_manager_user{
                        display: inline-block;
                }
            }
        }

I would very much appreciate some help in finding the best solution to this.

Aucun commentaire:

Enregistrer un commentaire