ID selectors overcome the problem of general styling, by selecting elements by their id. Element IDs have the benefit, but also the restriction, that they need to be unique in the HTML:
<!DOCTYPE html>
<html>
<head>
#mainparagraph {
color: red;
}
</head>
<body>
<p>This is a styled paragraph.</p>
<p id="mainparagraph">This is a styled paragraph.</p>
</body>
</html>
The previous example will style only one paragraph based on the id.
You always need to add the # prefix when selecting ids, both in JavaScript and in CSS.