Solution 1 :

<style>.menu > h3{
background-color: red;
}
</style>

you want to look up your css selectors https://www.w3schools.com/cssref/css_selectors.asp this is a good place to go for reference

Solution 2 :

I think your question needs more context… but anyways, the most efficient way IS to add a class to each of the h3 elements, but you could also access the h3 of the div like so

     <style>
     .main h3 {
     /*add property here*/
    }
    </style>
    <div class = "main">
   <h3 class="menu">Home</h3>
   <h3 class="menu">About</h3>
   <h3 class="menu">My work</h3>
   <h3 class="menu">Contact me</h3>
   <h3 class="menu">Reviews</h3>
   </div>

Now whatever property that’ll be added to .main h3 will only be applied to the h3 elements inside the main div.

Problem :

I want to apply a styling property to multiple h3 elements grouped in a div. I don’t want to apply the property to the div itself but to each of its elements. I know I can use class for each of them but that does not seem too efficient, also I don’t want to apply the property to the h3 tag because I will probably use it later with a different style.

h3 {
  display: inline;
}
.menu {
  background-color: red;
}
<div class="menu">
  <h3>Home</h3>
  <h3>About</h3>
  <h3>My work</h3>
  <h3>Contact me</h3>
  <h3>Reviews</h3>
</div>

I want something like this instead:

h3 {
  display: inline;
}
.menu {
  background-color: red;
}
<div>
  <h3 class="menu">Home</h3>
  <h3 class="menu">About</h3>
  <h3 class="menu">My work</h3>
  <h3 class="menu">Contact me</h3>
  <h3 class="menu">Reviews</h3>
</div>

Comments

Comment posted by Paulie_D

Please clarify your specific problem or add additional details to highlight exactly what you need. As it’s currently written, it’s hard to tell exactly what you’re asking.

Comment posted by Paulie_D

Individual classes is the most logical method here.

Comment posted by Albenis Kërqeli

its to hard to give a answer for this problem , please give some more details

Comment posted by Joseph

I want to apply the background-color: red; to each of the h3 elements but not to the div. I guess I will use the class in each of the h3 elements

By