Jump to content

Custom button scaling too small

Go to solution Solved by MAC1,

Recommended Posts

Hi,

I have a issue with my custom buttons.

The button becomes too small on different widths:
Large monitor looks fine, button is full size
image.thumb.jpeg.303d25bcbe348eb46b1ea1b4011625de.jpeg

On a smaller monitor the image scales down too much, I want to keep it at 100% the whole time
(like how buttons in squarespace behave):
image.thumb.jpeg.71301cf090368a6fb773241634fa0162.jpeg

Is it how i've set it up? can i add css that keeps the button at a suitable size?

Web: https://ellipse-teal-dl5w.squarespace.com/
Pass: 04

Here is the button  code at the moment, the hover works and the animated scaling also:

/* GET IN TOUCH BUTTON*/
div#block-yui_3_17_2_1_1701485718961_2891 {
    overflow: hidden;
    position: relative;
}

div#block-yui_3_17_2_1_1701485718961_2891 img {
    transition: transform 0.5s ease, opacity 1s ease;

    display: block;
    width: 100%;
    height: auto;
}

div#block-yui_3_17_2_1_1701485718961_2891:hover img {
    transform: scale(1.05);
opacity: 1;
content: url(https://images.squarespace-cdn.com/content/64d0a4ef828d1802cb65112a/94faff05-9d93-477d-952d-4ac5f8579fa3/BUT_getintouch_ON.png);

}


Appreciate any support on this Cheers,

Mac

Link to comment
  • 2 weeks later...
  • Solution
Posted (edited)

I got this code to work, hope it helps someone. Keeps the button image (no rescaling) at 250px at every screen width and also pumps it up to 280px at a window size bigger than 1200px :)

div#block-yui_3_17_2_1_1701485718961_2891 {
    width: 250px;
    height: 250px;
    overflow: hidden;
    margin: auto; 
    position: relative; 
    top: 50%;
    transform: translateY(-50%);
}

/* Media query for window width of 1200px */
@media (min-width: 1200px) {
    div#block-yui_3_17_2_1_1701485718961_2891 {
        width: 280px;
    }
}

 

Edited by MAC1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.