 <p>You can look into jQuery to dynamically change CSS properties as the certain events are called. You can find a great tutorial <a href="http://www.w3schools.com/jquery/css_css.asp" rel="nofollow">here</a>. Here is an example from an old project of mine:</p> <pre><code> $(window).scroll(function (e) { $el = $('.fixedElement'); if ($(this).scrollTop() &gt; 98 &amp;&amp; $el.css('position') != 'fixed') { $('.fixedElement').css({ 'position': 'fixed', 'top': '0px', 'width': '90%', 'min-width': '1200px' }); } }); </code></pre>