Adding background to the margin of a div

I have a CodePen here. A pretty unimpressive page.

What I want to be able to do is add a background image to the blank area to the right (the margin of the intro div). I can do it easily enough with some added markup but I’m wondering if I can do so without adding any more HTML. Any ideas, guys? It is possible?

You can do image borders. Would it work to swap the right margin for a right border?

1 Like

Not sure exactly how you want it, but a background image should do it, with a white background on the intro text to block it out.

1 Like

Thanks @WebMachine and @SamA74. I knew I forgot to mention something! I need to apply the background to the intro class as some pages don’t have it (the intro class that is) and take up the full 90% width, so no background is needed.

Now you are asking.
The intro block only occupies its own space, not that to the side of it, so applying it to that class will not be straight forward.
Perhaps with some some pseudo element, not sure. :thinking:

1 Like

Mmm. I tried :after but that just falls after the div vertically.

Maybe applying it to the wrapper after all, and adding a new div to those pages without the intro div would be best…

Something like:-

I would say, something very much like! Cheers @SamA74

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.