Need help with a piece of code.
how do I add a custom block of only an image.
Current blocks all include a text block which I do not need
Topic summary
Main issue: Create an image-only block in the Craft theme without accompanying text.
Proposed solution:
- Add a “Custom liquid” section in the theme customizer (via Add section).
- Insert HTML in that section to output the image (helper indicated to replace a placeholder like “YOUR IMAGE SRC HERE”).
- Add CSS in the custom CSS box: img { display: block; max-width: 100%; } to ensure responsive sizing and remove inline spacing.
- A screenshot was attached to illustrate where to add the section and code.
Notes/clarifications:
- The exact HTML snippet for the image was not included in the reply (appears to be a placeholder). Typically this would be an
tag inside the Custom liquid section.
Status:
- No confirmation from the original poster that this solved the need.
- Open item: Provide/confirm the precise HTML code for the image block if needed.
Hi @gemlette
You can use custom liquid section and write your HTML there and design accordingly
Thanks!
Yah. I was hoping to get the codes for the section
@gemlette
You can add “Custom liquid” section by clicking “Add section” button showing at bottom in customizer
You can put this code in custom liquid box
Replace image url for “YOUR IMAGE SRC HERE”
and put css in custom css box like this
img {
display: block;
max-width: 100%;
}
See attached screenshot:
Please check if something like this works for you
Thanks!
