Edited version of the original
How is declaring div#test different to declaring it as just #test? Also can I declare both of the in the same stylesheet i.e.
#div test {
}
#test {
}
Original question
If I were to declare the following style div#test how is that different to referencing a div element with an ID test e.g. <div id="test">content</div>
EDIT
To clarify what I mean is that how is div#test different to just #test and then referencing it in the div element.
it makes a sense if you have global css for every page and on one page you add #test to div element and on some other page you add it for p. in such case, even though p has id #test, css rules will not be applied to it if div#test is used instead of #test.
however probably you should consider renaming such conflicting elements, but not always it is possible (for example you are not the only one who works with html and css or some external plugins, whatever). of course it is not good protection, but still, could make sense in some specific cases.