CSS : which one has priority in one tag ID or CLASS ?

Here is sample of code which show the priority`s difference between ID and CLASS :
here below you see what ID has more over priority than CLASS .

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
p
{
border-style:solid;
border-top:thick double #ff0000;
}

.id2 { color: red; }
#id1 { color: blue; }
</style>
</head>

<body>
<p class="id2" id="id1">This is BLUE TEXT!</p>
<p class="id2" >This is RED TEXT.</p>
</body>

</html>