Why does the width of affix column change while scrolling in Bootstrap?


In Bootstrap I made two columns one with affix to make it fixed while scrolling and one normal column. Here is the <a href="http://jsfiddle.net/4zuo6dm7/2/" rel="nofollow">demo</a>

This is my code so far:

<body data-spy="scroll" data-target="#myScrollspy"> <div class="container"> <div class="row"> <div class="col-md-3" id="myScrollspy"> <div class="panel panel-default" data-spy="affix" data-offset-top="0"> <div class="panel-body">Lorem ipsum</div> </div> </div> <div class="col-md-9"> <div class="panel panel-default"> <div class="panel-body">

Lorem ipsum

</div> </div> </div> </div> </div> </body>

If you check the demo, as soon as you scroll down, the width of the small column which has affix changes. Why is that?

Is there any idea to fix it? Thanks


Because when the small column hits the top of the window, it's position property is set to fixed. If an element is fixed positioned, it is taken out of the normal flow of the page. So, it fills as much space as it need. You have to set the width for the small column when it becomes fixed.


  • AngularJs unit test - Check if “Init” function was called
  • VLC player event catch
  • Extending Boostrap to include extra small inline form
  • “stack level too deep” When Processing Carrierwave Image Versions in Nested Form
  • Compare a column between 2 csv files and write differences using Python
  • Create CSV file from c#: extra character in excel
  • AngularJS- How to pass data from one controller to another on ng-click()?
  • CreateWindowEx fails with ERROR_CANNOT_FIND_WND_CLASS
  • href inside href [duplicate]
  • wrong item changes in recyclerview
  • How to expand parent div to account for child's overflow?
  • C# List of Panels
  • Click on button in another program - FindWindow, C#
  • gspread or such: help me get cell coordinates (not value)
  • FileReader+canvas image loading problem
  • Insert into database using onclick function
  • Deselecting radio buttons while keeping the View Model in synch
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Align navbar back button on right side
  • DirectX11 ClearRenderTargetViewback with transparent buffer?
  • Validaiting emails with Net.Mail MailAddress
  • Shallow update not allowed (git > 1.9)
  • sending/ receiving email in Java
  • jquery mobile loadPage not working
  • Web-crawler for facebook in python
  • align graphs with different xlab
  • Akka Routing: Reply's send to router ends up as dead letters
  • Unanticipated behavior
  • Cannot Parse HTML Data Using Android / JSOUP
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • How to include full .NET prerequisite for Wix Burn installer
  • Java static initializers and reflection
  • Qt: Run a script BEFORE make
  • unknown Exception android
  • Can't mass-assign protected attributes when import data from csv file
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Unable to use reactive element in my shiny app
  • Conditional In-Line CSS for IE and Others?