Below I am writing about on how to display a small, large and proper image in a logo space in header. For example if I have a 500x500 pixel image,
I want to do the following things:
- Resize that to a 250x250 pixel image
- Make the actual visible image to be 100x100, but still have the scale of a 250x250 sized image.
- Center of the image to be at a location x,y.
.img_box { height: 120px; padding: 0; text-align: center; width: 120px; line-height:0px; } .img { max-height: 100%; max-width: 100%; position: relative; top: 50%; transform: translateY(-50%); -webkit-transform: translateY(-50%); -moz-transform: translateY(-50%); -ms-transform: translateY(-50%); -o-transform: translateY(-50%); } <div class="img_box"> <img src="images/img.jpg" class="img"> </div>
Related Tags
More From Oodles
Neha N | 14-Mar-2025
Ready to innovate? Let's get in touch
Request for Proposal
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Awadhesh Kumar
Awadhesh is an experienced UI developer with expertise in HTML 5, CSS 3, jQuery, Bootstrap and AngularJS.