Quick Fix: Center An Image Within A Block Element
February 6th, 2014
If you’re used to WordPress, you’re also used to it putting a paragraph around your images. This can cause some issues when trying to align something, especially when you are trying to center something. You’ve probably tried a couple things such as:
img {
text-align: center;
margin: 0 auto;
}
Only to find nothing happening. That would actually work fine if it wasn’t in that pesky <p> tag. Here’s the quick fix:
img {
margin: 0 auto;
display: block;
}

Leave a Reply