I have a list of contacts like this:
<div id=\"contact $name\">
Contact 1.
</div>
<div id=\"contact $name\">
Contact 2.
</div>
...and so on
$name
is the name of the contact. I need to do it this way, because somewhere I'm using a javascript for show / hide details for a selected contact so I need a unique id.
I would like to put some style on id contact
. I'm not very used with CSS but, I assume that there should exist the concept of inheritance for situations like that, right?
I tried to apply a testing style like:
#contact { font-size:20px; color:red; }
That should apply the style for all id's that have contact
and if I want some particular style for contact 1, I should use something like #contact Contact 1 { bla bla bla }
The problem is that isn't working. What I'm doing wrong there?
EDIT
<script type="text/javascript" charset="utf-8">
function showHide(elementid){
if (document.getElementById(elementid).style.display == 'none'){
document.getElementById(elementid).style.display = '';
} else {
document.getElementById(elementid).style.display = 'none';
}}</script>