servioret wedijotu servioret wedijotu - 1 year ago 74
CSS Question

Why div area still bigger more than image css?

Why div area still bigger more than image css ?

<div style="padding: 0px 0px;display: inline-table;background: red;">
<img src="" style="height: 70px;padding: 0;margin: 0; ">

How can i do for set div area to fit image ?

Answer Source

IMG - is inline element, so it behaves differently than block type elements. You can override that by setting it's display to block

If you replace "inline-table" for "inline-block" for the div and set display:block for img - everything will be fine. There is a good description in this answer on SO

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