# CSS Rules

**URL:** https://forum.kirupa.com/t/css-rules/214495
**Category:** web dev
**Created:** [January 29, 2007, 4:30pm UTC](https://forum.kirupa.com/t/css-rules/214495 "2007-01-29T16:30:17Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![s1ntax](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@s1ntax](https://forum.kirupa.com/u/s1ntax)
#### Post date: [January 29, 2007, 4:30pm UTC](https://forum.kirupa.com/t/css-rules/214495/1 "2007-01-29T16:30:17Z")

</div>

Anyone know if its possible to select an element by class AND id?

```php

  <?php

     $class = ( TRUE )?("showMe"):("hideMe)";
     echo "<div id=\"foo\" class=\"{$class}\"> Look its a div! </div>
";

  ?>

```

i need to access div#foo and then if div#foo has class hideMe use display:none; the showMe class is erroneous.

something like this (i know it doesnt work)

```auto

div#foo {
            /* styles */
           }

div#foo.hideMe {
                       display: none;
                     }

```

any ideas?

also, if anybody has ins with w3c i have a thought for a new CSS standard. Give rules =\> attributes the ability to be referenced. example (phpish syntax):

```auto

body {
         margin: 0px auto;
         background-color: #fff;
         font-family: Arial, Helvetica, Sans-Serif,  
         font-size: 12px;
         color: #000;
         border: 1px solid #0a0;
        }

div.classy {
               /* would match background-colors /*
               background-color: {body::this}; 
              
               /* would pull border-color attribute from the body rule /*
               color: {body::border-color};
              }

```

i think making CSS more operable might be a good move? any thoughts?
