I'm trying to create a conditional logic so that the class 'white-nav-bg' is added to the <nav> element on the 'blog' section entries only.

Below is the code I'm currently using to try and achieve this with a logic tag but it is adding the 'white-nav-bg' class to all pages on the site rather than just the blog section entry pages.

    <nav class="navbar navbar-default navbar-fixed-top {% for entry in craft.entries.section('blog').limit(1) %}{% if entry.type.handle == 'post' %}white-nav-bg{% endif %}{% endfor %}">

This code is in the '_layout.html' file, hence needing to figure out how to do conditional logic tags rather than adding the code differently in the blog template files.

After much time looking through Craft documentation I can't seem to find an example of how to do this. Any help would be gratefully received.

UPDATE:

Following helpful answers I have come to the following code, which works and allows me to define multiple sections to have the 'white-nav-bg' class.

    <nav class="navbar navbar-default navbar-fixed-top {% set segment1 = craft.request.segment(1) %}{% if segment1 == 'blog' %}white-nav-bg{% elseif segment1 == 'our-work' %}white-nav-bg{% endif %}">