Solution 1 :

Just put the code in the desired classes into the definition of the nav-item class

You could also use mixins with Sass

Problem :

I am starting to have the following situation in my code where I have multiple html elements which use the same set of classes

    <div class = 'nav-content row'>
            <div class="nav-item col s1 offset-s6 valign-wrapper"><h5>Home</h5></div>
            <div class="nav-item col s1 valign-wrapper"><h5>About</h5></div>
            <div class="nav-item col s1 valign-wrapper"><h5>Projects</53></div>
            <div class="nav-item col s1 valign-wrapper"><h5>Contact</h5></div>

I would like the class nav-item to include the col s1 and valign-wrapper classes.
Is it possible to do this?


Comment posted by Sean Doherty

This question should not have been closed. It is not a duplicate of the suggested question, and requires a more subtle answer than a generic css inheritance Q/A from 10 years ago.