Access span text from css with span[data-text="*"] - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Text

Description

Access span text from css with span[data-text="*"]

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">
span[data-text="*"]:before {
   content:attr(data-text);<!--from  w  w  w  . ja v  a 2  s.c  om-->
   color:Chartreuse;
   width:16px;
   height:16px;
}
</style> 
 </head> 
 <body> 
  <span data-text="*"></span>  
 </body>
</html>

Related Tutorials