Thursday, 2 May 2013

Display divs side by side in asp and css


Just change the float property to right or left for the child div and display property to inline-block for the parent div, see the example below


<div style="width: 960px; position: relative; display: inline-block;">
        <div style="width: 320px; float: right; background-color: #00FFFF;">
            <br />
            Mohammad
            <br />
        </div>
        <div style="width: 320px; float: right; background-color: #C0C0C0;">
            <br />
            Mohammad
            <br />
        </div>
        <div style="width: 320px; float: right; background-color: #008080;">
            <br />
            Mohammad
            <br />
        </div>
    </div>