Applying style to only post not pages

How can I apply a style to all posts, but apply a different style to pages (or remove that said style on posts, from pages). I am setting a margin on an element on posts, but the same margin on said element on pages screws up the design. How can I remove it from pages?

I tried using the following:

{{#is "page"}} 
    <style>
    .sidebar {
        	margin-bottom: 0 !important;
       	}
    </style>
    {{/is}}

Which didn’t work. Any advice?

Solved. I ended up using a few helpers inside the handlebars template directly to apply the style based on the page.

{{#is "home"}}
  <style>
.sidebar {
        margin-bottom: 0 !important;
    }
</style>
{{else if "post"}}
  <style>
.sidebar {
        margin-bottom: 34.2em !important;
    }
</style>
{{/is}}