Pratik N Pratik N - 2 years ago 73
Javascript Question

How to centre the content within a div without using margin property

I have a container within which i will get contents dynamically. i want all coming contents/div to be centred automatically.
i dont want to use margin property.

<div class="linContainer">

<div class="content1"></div>
<div class="content2"></div>


Answer Source

To center vertically AND horizontally, you can change the default display from block to table-cell.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download