Search code examples
htmlstylesheet

div width property with content


I have two div and they have some width. But I want each div to take full space as it's given in width property regardless of the content inside div s. Currently each div is taking space with respect to the content inside them and ignoring what is given in width property.

My HTML is given below,

  <div style="margin-left:100px; display:inline;  border-width:10px; width:30%; border-     style:solid;">
fawad
</div>
<div style=" margin-left:10px;  display:inline; border-width:10px; width:30%; border-style:solid">ali</div>

Solution

  • Just change your

    display:inline;
    

    to:

    display: inline-block;
    

    http://jsfiddle.net/osx76nbr/