Size of fixed position alerts in bootstrap
<p>I'm trying to design a web page using Twitter Bootstrap with a "floating" (fixed-position) alert at the top, like so:</p>

<p>HTML:</p>

<pre><code>&lt;div class="container"&gt;
  &lt;div class="row"&gt;
    &lt;div class="col-sm-12"&gt;
      &lt;div id="top-message" class="container row col-sm-12"&gt;
       &lt;div class="alert alert-danger"&gt;
        Hi there!
       &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;!-- page content --&gt;
  &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>CSS:</p>

<pre><code>#top-message {
    z-index: 10;
    position: fixed;
    width: 100%;
}
</code></pre>

<p><a href="https://jsfiddle.net/zs1f8u6j/" rel="nofollow noreferrer">JSFiddle</a></p>

<p>On smaller screens, this works perfectly:</p>

<p><a href="https://i.stack.imgur.com/UjeuX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UjeuX.png" alt="On smaller screens"></a></p>

<p>However, on larger screens, the alert simply extends out like this:</p>

<p><a href="https://i.stack.imgur.com/fvTU2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fvTU2.png" alt="On larger screens"></a></p>

<p>Removing the <code>width: 100%</code> from <code>top-message</code> wouldn't be an option either, since I need the alert to occupy some width even though the text is small.</p>

<p>How should I design the page so that the alert is maintained in the middle of the page like in smaller screens; for any size of the screen on which the page is rendered?</p>