Hello, I would like to make my rich text buttons a certain aspect ratio (8:1) because i am making them custom shapes. How do I go about doing this? I have already tried this code (below) but it did nothing.
.rich-text__buttons button {
aspect-ratio: 8 / 1 !important; /* width : height */
width: 100% !important;
}
PW: ellaella
Hi @ellacoker ,
You’ve used the wrong class name — you’re using a tag name instead of a class selector.
Please update it to the code below:
.rich-text__buttons .button {
aspect-ratio: 8 / 1 !important; /* width : height */
width: 100% !important;
}
Hi there,
You can keep your rich text buttons at a perfect 8:1 aspect ratio by removing fixed paddings/heights and letting CSS handle the ratio. For example:
.rich-text__buttons button {
aspect-ratio: 8 / 1;
width: 100%;
max-width: 400px;
display: flex;
align-items: center;
justify-content: center;
padding: 0;
box-sizing: border-box;
}
Make sure no other CSS in your theme sets a fixed height or large padding for the button, as that can override the aspect ratio.
At Tipo, we can also help you fine-tune this for all screen sizes so your custom-shaped buttons look consistent everywhere.
— Sinh, Developer at Tipo
/* Rich Text buttons aspect ratio fix /
.rich-text__buttons a,
.rich-text__buttons button {
display: inline-block !important;
aspect-ratio: 8 / 1 !important; / width : height /
width: auto !important; / change to 100% if you want full width */
height: auto !important;
line-height: normal !important;
padding: 0 !important;
}
/* Ensure the text inside stays centered */
.rich-text__buttons a span,
.rich-text__buttons button span {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
width: 100%;
}