I am currently working on a push menu that shifts the main content container by adding margin-left to it. I am aiming to achieve a background image effect similar to what is seen on .
Here is the progress I have made so far in my codepen:
https://codepen.io/Maynards/pen/qBVLqLL
<div class="secondaryMenu">
<div class="secondaryMenuItem">
<div>Secondary Menu 1</div>
</div>
<div class="secondaryMenuItem active overlay">
<div>Secondary Menu 2</div>
</div>
<div class="secondaryMenuItem active">
<div>Secondary Menu 3</div>
</div>
</div>
<div class="primaryMenu">
<ul class="primaryMenuItems">
<li class="primaryMenuItem">
<div class="primaryMenuItemSelector">
<div>1</div>
<div class="primaryMenuItemExtra">Hidden Primary Menu Content</div>
</div>
</li>
... // More HTML code here
</ul>
</div>
// Continuing with more HTML and CSS code...
In my current work, I encountered difficulties where the background image was not resizing when the main content container was adjusted. Unfortunately, the image no longer appears in the CodePen preview, indicating a step backwards in the process.
EDIT 1: Additional Context & Image Samples
The desired outcome involves having the background image confined to the container beside the menu (where the <p>
text is located). However, as it stands now, the background image seems to be truncated on the left side.
Expanding Menu https://i.stack.imgur.com/3Awcn.png
Collapsed Menu https://i.stack.imgur.com/5WF9l.png
Additionally, I have faced challenges in getting the gradient to display on top of the background image and beneath the content.
EDIT: Final Solution
By implementing the solution provided in the accepted answer, I managed to arrive at this result