Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove extra margin-bottom from floating image?

Tags:

html

css

xhtml

When we use <img> inside <p><img style="float:left">dummy text dummy text dummy text dummy text</p> then how can we have the same margin at right and bottom of the image?

http://jitendravyas.com/image-margin.htm

like image 441
Jitendra Vyas Avatar asked Nov 03 '09 10:11

Jitendra Vyas


People also ask

How do I get rid of extra margins in CSS?

Adjusting the Margin Size of an HTML Element With CSS You can remove this margin by setting the top and left margin to zero. Like the padding and border, the sizes of specific sides of the margin can be set using margin-left , margin-right , margin-top , and margin-bottom .

What does float inherit mean in CSS?

none (default): The element doesn't float. It is simply displayed where it occurs in the text. left: The element floats to the left of its container. right: The element floats to the right of its container. inherit: The element inherits the float value of its parent.

Can we use float in CSS?

The float CSS property places an element on the left or right side of its container, allowing text and inline elements to wrap around it. The element is removed from the normal flow of the page, though still remaining a part of the flow (in contrast to absolute positioning).

For what design purpose would it be beneficial to use float?

Floats for layout Aside from the simple example of wrapping text around images, floats can be used to create entire web layouts. Floats are also helpful for layout in smaller instances.


1 Answers

Use property vertical-align: bottom; to image, then the extra space from bottom will be deleted.

like image 116
Sachin Kumar Avatar answered Oct 19 '22 18:10

Sachin Kumar