Note that there are some explanatory texts on larger screens.

plurals
  1. POdiv isn't centering , one div is one div is not
    text
    copied!<p>Demo Page: <a href="http://apps.pc-tips.in/play/" rel="nofollow">http://apps.pc-tips.in/play/</a></p> <p>In the above, the div containing "Ask any question &amp; get" is centered, but the div containg the line "answers on" is not. why? Both have been styled similarly. given width, absolute position, margin auto.</p> <p>The code:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Untitled Document&lt;/title&gt; &lt;style type="text/css"&gt; div { margin:0 ; padding:0 ; } #sidebar { height: 600px; width: 200px; } #topside { height: 108px; background-image: url(Untitled-3.jpg); background-repeat: repeat-x; text-align: center; position: relative; } .down { bottom: 3px; position: absolute; margin: auto; width: 200px; } #bottomside { background-image: url(Untitled-4.jpg); height: 492px; position: relative; } #wrapper #sidebar #topside { color: #FFF; font-size: 0.9em; font-weight: bold; } .delhi { font-size: 1.8em; } .top { top: 3px; position: absolute; margin-left: auto; margin-right: auto; width: 100px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="wrapper"&gt; &lt;div id="sidebar"&gt; &lt;div id="topside"&gt;&lt;br /&gt; &lt;span class="delhi"&gt;Delhi &lt;/span&gt; Questions and answers. &lt;div class="down"&gt; Ask any question &amp; get &lt;/div&gt; &lt;/div&gt; &lt;div id="bottomside"&gt; &lt;div class="top"&gt; answers on &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>would anyone like to point out what I am missing here? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload