styling the contents

I’ll refer you to the excellent template hierarchy diagram from the Codex, which explains how template files are chosen:

WordPress template hierarchy

That explains the “which page” aspect of your question, but you also mentioned modifying CSS based on content. The body_class() function should be a part of your template, and it will apply a number of classes to the <body> tag which allow you to target CSS at specific types of content. For example, given a category “spooky,” this CSS rule would give all “spooky” pages a black background:

.category-spooky { background-color: #000; }

Many other variations exist, for other types of targeting.