I have a div, which contains an article. I mean, it may contain text and images. Something like this:
Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah Blah.
{IMAGE}
Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah
Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah.
{IMAGE}
Blah Blah Blah Blah Blah Blah Blah Blah.
So, there may not be a div around every image.
But I want to horizontally align center the images with jQuery. My idea is creating a div around every image (with jQuery) with a specific class.
But I don’t know how to do that in jQuery.
How to do that? OR Is there any better way?
Edit: The content is downloaded from the feed of another website. And I want to align the images center horizontally.
No need to add div around img it can be done only by css
Try This fiddle
Just use
display:blockandmargin:auto