This members-only tutorial provides the steps to set up an inline image background using object-fit: cover
in Oxygen.
In our earlier tutorial titled Responsive hero image with text overlay in Oxygen, the image was shown in its aspect ratio with the image stretched to fill the viewport width. This means depending on your image, it could be pretty tall. This is not ideal for a hero section.
In the other tutorial titled Inline Background Images in Oxygen, the image was shown using absolute positioning whereas in this tutorial, it is the hero section's content i.e., headline, subtitle and CTA button that are absolutely positioned.
The technique in this tutorial involves setting a fixed height for the Section, adding a 100% width and 100% height object-fit: cover
image, and absolutely positioning the hero section's content Div.
Manual instructions below. 1-click Hydrogen code can be found at the end of the tutorial.
Step 1
In the Oxygen editor add a Section.
Horizontal Item Alignment: Center
Size & Spacing
Container Padding: 0 on all sides
This is a premium members-only content.
To view the rest of the content, please sign up for membership ($47/month or $599 one-time).
Already a member? Log in below or here.