Home >Web Front-end >CSS Tutorial >How Do I Horizontally Center an Image Inside a Div?
How to Center an Image Horizontally Within a Div Element
You're experiencing difficulty in horizontally centering an image within its container div. Despite attempting provided solutions, the issue persists.
To resolve this, consider the following CSS:
#artiststhumbnail a img { display:block; margin:auto; }
This solution employs the following techniques:
This approach has been demonstrated and proven effective in the following fiddle: http://jsfiddle.net/marvo/3k3CC/2/
The above is the detailed content of How Do I Horizontally Center an Image Inside a Div?. For more information, please follow other related articles on the PHP Chinese website!