css - Good practice on selecting a list menu -


considering markup:

 <div id="container">     <div id="mainmenu">      <ul>       <li> <a href=""><h1>my dashboard</h1></a></li><br>       <li> <a href=""><h1>about</h1></a></li><br>       <li> <a href=""><h1>contact</h1></a></li><br>       <li> <a href=""><h1>setttings</h1></a></li><br>       <li> <a href=""><h1>log out</h1></a></li><br>      </ul>     </div>  </div> 

selecting way valid thing? having issues properties.

#container ul li{     display: inline-block;  }   #mainmenu ul li a{}  #mainmenu ul li a:hover{} 

full sample: https://jsfiddle.net/jhr1q1q4/

i'm unsure you're asking...

strictly speaking, selectors provided valid , select <a> elements within #mainmenu element.

but ask: ul li part of selectors necessary? rewrite both of them as

#mainmenu {} #mainmenu a:hover {} 

and work same , require less parsing. if wanted select <a> elements descendants of <li> elements, keep li in selector; however, ul not necessary -- implied <li> elements children of <ul> (assuming you're writing valid html).

another note: <a> elements inline, meaning they're meant act @ text level. <h1> elements, on other hand, block-level elements, , not belong inside <a> elements. in fact, shouldn't have more 1 <h1> on page, let alone using <h1>'s mark menu items. if want menu items big headers, use css rules style them way.

i having issues properties.

what properties causing trouble?