Selectors by attribute name - HTML CSS CSS

HTML CSS examples for CSS:Selector

Description

Selectors by attribute name

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
[data-name] {<!--from  w w w  .  j av  a2 s . co m-->
   background-color:Chartreuse;
}

[data-name] [data-someAttribute] {
   background-color:yellow;
   text-decoration:underline;
}
</style> 
 </head> 
 <body> 
  <div data-name="something"> 
   <p>Lorem ipsum dolor sit </p> 
   <span data-someattribute="someAttribute">Lorem ipsum dolor sit amet, con</span> 
  </div>  
 </body>
</html>

Related Tutorials