Skip to content Skip to sidebar Skip to footer

Div Is Shown In Wrong Position

I have such code:
Product c</div>

<h2 id="solution_1">Solution 1:

</h2>
<div class="answer-desc"><p>Add <code>margin: 0 auto</code> to that div: </p>
<pre><code id="code_1" class="hljs language-xml"><span class="hljs-tag"><<span class="hljs-name">div</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"clear: both; text-align: center; width:985px; margin: 0 auto;"</span>></span><span class="hljs-tag"><<span class="hljs-name">img</span> <span class="hljs-attr">border</span>=<span class="hljs-string">"0"</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"graphic/buttom.png"</span> <span class="hljs-attr">width</span>=<span class="hljs-string">"524"</span> <span class="hljs-attr">height</span>=<span class="hljs-string">"42"</span>></span><span class="hljs-tag"></<span class="hljs-name">div</span>></span>
</code><button class="copy-btn btn btn-secondary btn-sm" onclick="copyCode(this,Copy

Solution 2:

In your final div you have text-aling: center instead of text-align: center.


Solution 3:

Add margin: 0 auto; to that marked div.


Solution 4:

You have set text-aling:center when it should be text-align:center. Fixing it you will get image positioned in center of a div. To center a div itself, add margin: 0 auto to that div

Demo: http://jsfiddle.net/8p7A2/1/ with both fixed text-align and margin added.


Post a Comment for "Div Is Shown In Wrong Position"