Hi, I would like to remove padding on mobile for “Image with Rich Text” component. Currently there are a lot of white space.
Topic summary
Issue: User seeks to remove mobile padding from the “Image with Rich Text” component in Shopify 2.0, noting excessive white space on mobile devices.
Troubleshooting Process:
- Initial attempts to share store URL and locate the specific section faced challenges due to preview link limitations and theme differences
- User identified the issue relates to
component-image-with-text.cssand shared relevant CSS code - Directed helper to find the section under “One of a Kind” product page
Solution Provided:
Add custom CSS to theme.liquid file before the closing </style> tag:
@media only screen and (max-width: 767px) {
.image-with-text--overlap .image-with-text__content {
width: 100% !important;
margin: 0 !important;
padding: 0 !important;
justify-content: left;
}
}
Steps:
- Navigate to Online Store → Theme → Edit code
- Open
theme.liquidfile - Paste the CSS code before
</style>tag
Outcome: Solution successfully resolved the padding issue. User confirmed it works.
Hello @User1233
would you like to share your store URL please so I can provide you css to remove padding on mobile devices.
Here is the preview:
https://xc456drwly6wx2zf-606044221.shopifypreview.com
hello @User1233
there is no image with text section in provided link…can you please share me full url
I think it’s part of the: commponent-image-with-text.css
.image-with-text .grid {
margin-bottom: 0;
}
.image-with-text .grid__item {
position: relative;
}
@media screen and (min-width: 769px) {
.image-with-text__grid--reverse {
flex-direction: row-reverse;
}
}
.image-with-text__media {
min-height: 100%;
overflow: visible;
}
.image-with-text__media--small {
height: 19.4rem;
}
.image-with-text__media--large {
height: 43.5rem;
}
@media screen and (min-width: 769px) {
.image-with-text__media--small {
height: 31.4rem;
}
.image-with-text__media--large {
height: 69.5rem;
}
}
.image-with-text__media--placeholder {
position: relative;
overflow: hidden;
}
.image-with-text__media--placeholder:after {
content: '';
position: absolute;
width: 100%;
height: 100%;
background: rgba(var(--color-foreground), 0.04);
}
.image-with-text__media--placeholder.image-with-text__media--adapt {
height: 20rem;
}
@media screen and (min-width: 769px) {
.image-with-text__media--placeholder.image-with-text__media--adapt {
height: 30rem;
}
}
.image-with-text__media--placeholder > svg {
position: absolute;
left: 50%;
max-width: 100rem;
top: 50%;
transform: translate(-50%, -50%);
width: 100%;
fill: currentColor;
}
.image-with-text__content {
align-items: flex-start;
display: flex;
flex-direction: column;
height: 100%;
justify-content: center;
align-self: center;
padding: 4rem calc(4rem / var(--font-body-scale)) 5rem;
position: relative;
z-index: 1;
}
.image-with-text .grid__item::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
}
.image-with-text:not(.image-with-text--overlap) .image-with-text__media-item:after {
border-radius: var(--media-radius);
box-shadow: var(--media-shadow-horizontal-offset)
var(--media-shadow-vertical-offset)
var(--media-shadow-blur-radius)
rgba(var(--color-shadow), var(--media-shadow-opacity));
}
.image-with-text:not(.image-with-text--overlap) .image-with-text__text-item:after {
border-radius: var(--text-boxes-radius);
box-shadow: var(--text-boxes-shadow-horizontal-offset)
var(--text-boxes-shadow-vertical-offset)
var(--text-boxes-shadow-blur-radius)
rgba(var(--color-shadow), var(--text-boxes-shadow-opacity));
}
.image-with-text .image-with-text__media-item > * {
border-radius: var(--media-radius);
overflow: hidden;
box-shadow: var(--media-shadow-horizontal-offset)
var(--media-shadow-vertical-offset)
var(--media-shadow-blur-radius)
rgba(var(--color-shadow), var(--media-shadow-opacity));
}
.image-with-text .global-media-settings {
overflow: hidden !important;
}
.image-with-text .image-with-text__text-item > * {
border-radius: var(--text-boxes-radius);
overflow: hidden;
box-shadow: var(--text-boxes-shadow-horizontal-offset)
var(--text-boxes-shadow-vertical-offset)
var(--text-boxes-shadow-blur-radius)
rgba(var(--color-shadow), var(--text-boxes-shadow-opacity));
}
.image-with-text:not(.image-with-text--overlap) .image-with-text__media-item > *,
.image-with-text:not(.image-with-text--overlap) .image-with-text__text-item > * {
box-shadow: none;
}
@media screen and (max-width: 769px) {
.image-with-text.collapse-corners:not(.image-with-text--overlap) .image-with-text__media-item:after,
.image-with-text.collapse-corners:not(.image-with-text--overlap) .grid__item .image-with-text__media,
.image-with-text.collapse-corners:not(.image-with-text--overlap) .image-with-text__media img {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.image-with-text.collapse-corners:not(.image-with-text--overlap) .image-with-text__text-item:after,
.image-with-text.collapse-corners:not(.image-with-text--overlap) .grid__item .image-with-text__content {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.image-with-text.collapse-borders:not(.image-with-text--overlap) .image-with-text__content {
border-top: 0;
}
}
.image-with-text__content--mobile-right > * {
align-self: flex-end;
text-align: right;
}
.image-with-text__content--mobile-center > * {
align-self: center;
text-align: center;
}
.image-with-text--overlap .image-with-text__content {
width: 90%;
margin: -3rem auto 0;
}
@media screen and (min-width: 750px) {
.image-with-text__grid--reverse .image-with-text__content {
margin-left: auto;
}
.image-with-text__content--bottom {
justify-content: flex-end;
align-self: flex-end;
}
.image-with-text__content--top {
justify-content: flex-start;
align-self: flex-start;
}
.image-with-text__content--desktop-right > * {
align-self: flex-end;
text-align: right;
}
.image-with-text__content--desktop-left > * {
align-self: flex-start;
text-align: left;
}
.image-with-text__content--desktop-center > * {
align-self: center;
text-align: center;
}
.image-with-text--overlap .image-with-text__text-item {
display: flex;
padding: 3rem 0;
}
.image-with-text--overlap .image-with-text__content {
height: auto;
width: calc(100% + 4rem);
min-width: calc(100% + 4rem);
margin-top: 0;
margin-left: -4rem;
}
.image-with-text--overlap .image-with-text__grid--reverse .image-with-text__content {
margin-left: 0;
margin-right: -4rem;
}
.image-with-text--overlap .image-with-text__grid--reverse .image-with-text__text-item {
justify-content: flex-end;
}
.image-with-text--overlap .image-with-text__media-item--top {
align-self: flex-start;
}
.image-with-text--overlap .image-with-text__media-item--middle {
align-self: center;
}
.image-with-text--overlap .image-with-text__media-item--bottom {
align-self: flex-end;
}
.image-with-text__media-item--small,
.image-with-text__media-item--large + .image-with-text__text-item {
flex-grow: 0;
}
.image-with-text.collapse-corners:not(.image-with-text--overlap) .grid:not(.image-with-text__grid--reverse) .image-with-text__media-item:after,
.image-with-text.collapse-corners:not(.image-with-text--overlap) .grid:not(.image-with-text__grid--reverse) .image-with-text__media,
.image-with-text.collapse-corners:not(.image-with-text--overlap) .grid:not(.image-with-text__grid--reverse) .image-with-text__media img,
.image-with-text.collapse-corners:not(.image-with-text--overlap) .image-with-text__grid--reverse .image-with-text__text-item:after,
.image-with-text.collapse-corners:not(.image-with-text--overlap) .image-with-text__grid--reverse .image-with-text__content,
.image-with-text.collapse-corners:not(.image-with-text--overlap) .image-with-text__grid--reverse .image-with-text__content:after {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.image-with-text.collapse-corners:not(.image-with-text--overlap) .grid:not(.image-with-text__grid--reverse) .image-with-text__text-item:after,
.image-with-text.collapse-corners:not(.image-with-text--overlap) .grid:not(.image-with-text__grid--reverse) .image-with-text__content,
.image-with-text.collapse-corners:not(.image-with-text--overlap) .grid:not(.image-with-text__grid--reverse) .image-with-text__content:after,
.image-with-text.collapse-corners:not(.image-with-text--overlap) .image-with-text__grid--reverse .image-with-text__media-item:after,
.image-with-text.collapse-corners:not(.image-with-text--overlap) .image-with-text__grid--reverse .image-with-text__media,
.image-with-text.collapse-corners:not(.image-with-text--overlap) .image-with-text__grid--reverse .image-with-text__media img {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.image-with-text.collapse-borders:not(.image-with-text--overlap) .grid:not(.image-with-text__grid--reverse) .image-with-text__content {
border-left: 0;
}
.image-with-text.collapse-borders:not(.image-with-text--overlap) .image-with-text__grid--reverse .image-with-text__content {
border-right: 0;
}
}
.image-with-text:not(.collapse-corners, .image-with-text--overlap) .image-with-text__media-item {
z-index: 2;
}
.image-with-text__content {
border-radius: var(--text-boxes-radius);
box-shadow: var(--text-boxes-shadow-horizontal-offset)
var(--text-boxes-shadow-vertical-offset)
var(--text-boxes-shadow-blur-radius)
rgba(var(--color-shadow), var(--text-boxes-shadow-opacity));
}
@media screen and (min-width: 990px) {
.image-with-text__content {
padding: 6rem 7rem 7rem;
}
}
.image-with-text__content > * + * {
margin-top: 2rem;
}
.image-with-text__content > .image-with-text__text:empty ~ a {
margin-top: 2rem;
}
.image-with-text__content > :first-child:is(.image-with-text__heading),
.image-with-text__text--caption + .image-with-text__heading,
.image-with-text__text--caption:first-child {
margin-top: 0;
}
.image-with-text__content :last-child:is(.image-with-text__heading),
.image-with-text__text--caption {
margin-bottom: 0;
}
.image-with-text__content .button + .image-with-text__text {
margin-top: 2rem;
}
.image-with-text__content .image-with-text__text + .button {
margin-top: 3rem;
}
.image-with-text__heading {
word-break: break-word;
margin-bottom: 0;
}
.image-with-text__text p {
word-break: break-word;
margin-top: 0;
margin-bottom: 1rem;
}
/* check for flexbox gap in older Safari versions */
@supports not (inset: 10px) {
.image-with-text .grid {
margin-left: 0;
}
}
@media only screen and(max-width:748px){
.main-content-wrapper {
margin-left: 0px !important;
margin-right: 0px !important;
padding-left: 0px !important;
padding-right: 0px !important;
}
}
I can’t share the full url because it has different theme.
Navigate to: “One of a Kind” menu item and select any product. You will see an image with text section on the product page.
Hello @User1233
You can add code by following these steps to remove padding on image with text section
-
Go to Online Store → Theme → Edit code.
-
Open your theme.liquid theme file
-
Paste the below code before
It works!
Thank you!!!
