html - CSS Selectors: if div's class name contains AT LEAST one char -


what correct css selector if want know if there's @ least 1 character in element's class name?

i use know if div class name inside .bar begins "foo-":

.bar div[class^="foo-"] {display: block;} 

but how check if there's @ least 1 char (letter or number or special char) in class name?

you can check if element has empty or missing class attribute this:

div { color: red; } /* has class attribute @ least 1 character */  div:not([class=""]) { color: blue; } /* has empty class attribute */  div:not([class]) { color: green; } /* has no class attribute */
<div class="foo">foo</div>  <div class="">bar</div>  <div>baz</div>


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -