php - How do you center an image in a specified area, without resizing the image? -
I want to center an image without resizing it in any area ... I am using HTML.
Example:
I have an image & lt; Img src = 'img1.png' width = '64 'height =' 64 '& gt; - The image is actually 64x64, it is fully displayed.
Now, I have another image & lt; Img src = 'img2.png' width = '64 'height =' 64 '& gt; However, this is not as big as it should be, its 32x32 - what happens here, it changes the image to 64x64 and it looks like $% ^ & amp;
How do I make the images smaller, then the desired width and height can be centered without any resizing in the 'IMG' area?
What you need is something like this:
& lt; Div class = "box" & gt; & Lt; Img src = "size of the picture you want" /> & Lt; / Div & gt;
For more styling (in external stylesheets, nuts) you will apply:
Solid; Height: 64px; Width: 64px; Background: # 444; Exhibit: Table-Cell; Vertical-row: middle; } .box IMG {display: block; Margin: 0 px auto; }
This works for images with dimensions & lt; = 64x64px, and is easily replaceable to work with big photos
Comments
Post a Comment