search

Home  >  Q&A  >  body text

Center align DIV with content on both sides

So I have 5 items (within the containing DIV). The project lineup is as follows:

TextImageDIVImageText

I want it to appear with the DIV in the center, the image "hugging" the DIV, and then the text "hugging" the image, so any remaining space will be to the left or right of the containing DIV.

Current appearance I need how it looks

I've used flex to try and achieve this, but that just centers the entire content of the containing DIV, rather than the DIV being completely centered which I want.

P粉352408038P粉352408038261 days ago3620

reply all(1)I'll reply

  • P粉739942405

    P粉7399424052024-04-05 22:16:49

    Sorry, after an hour of more searching I found a thread related to fixing a very similar need to mine.

    Solution here - How to align and center 3 divs without affecting the middle div

    reply
    0
  • Cancelreply