Link to home
Start Free TrialLog in
Avatar of Alain Bensimon
Alain Bensimon

asked on

Select all tables with a given class and apply a class to the firt cell and another one to the second cell.

Hello,
I am working on a html document and I have the following tables


<table class="titles">
        <tr>
            <td class="cells">Nom de l'assuré</td>
            <td class="content">{{#childtable.place.rows}}{{fields.name}}{{/childtable.place.rows}}</td>
        </tr>
        <tr>
            <td class="cells">Lieu du sinistre</td>
            <td class="content">{{#childtable.address_view.rows}}{{fields.address}}&nbsp;-&nbsp;{{fields.second_address}}{{/childtable.address_view.rows}}</td>
        </tr>
        <tr>
            <td class="cells">Adresse de l'assuré</td>
            <td class="content">{{#childtable.address_view.rows}}{{fields.address}}&nbsp;-&nbsp;{{fields.second_address}}{{/childtable.address_view.rows}}</td>
        </tr>
        <tr>
            <td class="cells">N° de dossier</td>
            <td class="content">{{#childtable.request.rows}}{{fields.user_def16}}{{/childtable.request.rows}}</td>
        </tr>
    </table>
With the following CSS:
.titles{
            border-left: solid grey;
            border-width: thick;
            border-collapse: collapse;
        }

        .cells{
            font-weight: bold;
            background-color: lightgrey;
            padding-left: 3px;
            width: 25%;
        }
        .content{
            background-color: paleturquoise;
            width: 75%;
            padding-left: 3px;
            border: solid thin black;
            border-width: 0px 0px 1px 1px;
        }


Since I have a lot fof tables with taht layout, and I want to avoid to put the class .cells and the class .content to all the cells of the table, I would like a css code that can select all tables that have the class "titles" and apply them the class.

Thank youUser generated image
ASKER CERTIFIED SOLUTION
Avatar of Jan Louwerens
Jan Louwerens
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Alain Bensimon
Alain Bensimon

ASKER

Thank you.