What could be causing the issue with the transform property not functioning correctly?

When using two transforms, they typically do not apply simultaneously. However, during the hover event, they can replace each other. Below is the code for a button that I am attempting to create, but the properties do not seem to work properly upon hovering. Additionally, the down-arrow that I am trying to insert is not perfectly centered, forcing me to use padding to achieve centering!

    .btn__bg {
        position: absolute;
        display: inline-block;
        opacity: 0;
        top: 75%;
        left: 50%;
        transform: translate(-50%, -50%);
        height: 60px;
        width: 60px;
        background-color: #000;
        border-radius: 50%;
        text-align: center;
        animation: fadeInTop 1.2s forwards ease-out 1.5s;
        transition: all .2s;
        box-shadow: 0 4px 40px rgba(0,0,0,.3);
    }

    .btn__content {
        font-size: 30px;
        color: #fff;
        font-weight: 100;
        text-decoration: none;
        line-height: normal;
    }

    .btn__down--text {
        display: inline-block;
        vertical-align: middle;
    }

    .btn__bg:hover {
        transform: translate(-50%, -50%) scale(1.5);
    }

    .btn__bg:hover ~ .btn__down--text {
        vertical-align: middle;
    }
   <div class="header__main--text">
        <h1 class="header__heading--primary usr-res">welcome</h1>
            <a href="#" class="btn btn__bg btn__content usr-res">
                <span class="btn__down--text">&downarrow;</span>
            </a>
    </div>

If anyone could provide assistance on this matter, it would be greatly appreciated!

Answer №1

It seems like there may be some confusion about what you're asking: Does the scaling function correctly?

To adjust the vertical position of the arrow, you can utilize a margin-top on the span element that contains it.

.btn__bg {
    position: absolute;
    display: inline-block;
    opacity: 1;
    top: 75%;
    left: 50%;
    transform: translate(-50%, -50%);
    height: 60px;
    width: 60px;
    background-color: white;
    border-radius: 50%;
    text-align: center;
    animation: fadeInTop 1.2s forwards ease-out 1.5s;
    transition: all .2s;
    box-shadow: 0 4px 40px rgba(0,0,0,.3);
}

.btn__content {
    font-size: 30px;
    color: #000;
    font-weight: 100;
    text-decoration: none;
    line-height: normal;
}

.btn__down--text {
    display: inline-block;
    margin-top:0.3em;
}

.btn__bg:hover {
    transform: translate(-50%, -50%) scale(1.5);
}

.btn__bg:hover ~ .btn__down--text {
    vertical-align: middle;
}
<div class="header__main--text">
    <h1 class="header__heading--primary usr-res">welcome</h1>
        <a href="#" class="btn btn__bg btn__content usr-res">
            <span class="btn__down--text">&downarrow;</span>
        </a>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to move between websites or pages without having to reload the current page using a selector?

Have you ever wondered how to create a webpage where users can navigate to other websites or pages without seeing their address, simply by selecting from a drop-down menu? Take a look at this example. Another similar example can be found here. When visit ...

Disable the default Bootstrap styling for the pre element

Utilizing Bootstrap has caused the <pre> tag in my code to be styled, which I find undesirable. Despite knowing that I can override it, pinpointing the specific attributes that need adjustment to revert <pre> back to its default HTML appearance ...

Ways to apply color conditions to table rows based on table data values?

I am using ngFor to create a table from two arrays in Angular typescript. <tr *ngFor="let e of lis1; let k=index"> <td>{{e}} </td> <td>{{lis2[k]}}</td> </tr> The resulting table l ...

Are there any ways to bring visual attention to a GoDaddy template's SEND button using HTML or JS when the original code is unavailable?

I'm currently working on a GoDaddy website using a template that doesn't clearly highlight the SEND button in a Contact Us form. In order to comply with WCAG accessibility standards, active elements must have visible focus indicators. However, si ...

Loading JS and CSS files in relation to the website root directory

When it comes to including CSS/JS files, what are the best practices for defining the file URI? Some people prefer to include files relative to the website root by specifying the full URI: <link rel="stylesheet" href="/my/path/to/css/main.css"> Thi ...

Attempting to get the boxes in the final row to show up

Exploring new territories in web design, I'm currently working on achieving the layout shown below: Box Layout I've encountered an issue where the last row of 4 boxes in the middle section is not appearing as intended. Once this row is successfu ...

What are some strategies for preloading a webpage to improve loading times?

My webpage contains multiple images, but the browser loads them one by one when a user visits the page. I would like to display a "loading" gif in the center of the page first and only show the entire webpage once all the images have been downloaded. Is ...

Is there a way to arrange the components of my form so that the questions are positioned on the left side and the choices are displayed on the right

As I am creating a form, my goal is to align the information within it in a way that places the questions on the left side and the options on the right. I have experimented with utilizing IDs, centering them, and adjusting their positioning from left to r ...

Creating a Dropdown Filter using Vanilla JavaScript

I am currently working on a project for one of my college courses, which involves creating a dropdown list filter using pure JavaScript to filter a grid of images in HTML/CSS. The main challenge I am facing is that this filter needs to be able to work with ...

Attempting to create a dynamic layout for the objects using media queries and flexbox, however, the results are not as expected

.container { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; flex-direction: column; } .item { margin: 10px; border: 1px solid lightgray; border-radius: 10px; overflow: hidden; width: 100%; } @media scree ...

solve the issue of images getting resized in bootstrap 4

I'm facing a challenge with maintaining the size of logo images within their "circle containers" regardless of the browser width. The containers are set at 100px by 100px using the following CSS: .timeline-image::before { content: ""; width: ...

Adjust the dimensions of the initial cell

I need to adjust the size of the initial "generated" cell in a grid. The grid is not present in the HTML markup until JavaScript prints RSS information on it, making it difficult to target specific rows or cells directly. Note: The first element is hidden ...

What's causing the HTML body to be fixed at the top of the viewport?

Currently, I am in the process of developing a commandline tool to quickly generate an HTML Bootstrap starter template for my personal use. The main issue I am facing is with the index page, where a basic navigation bar should be displayed at the top, and ...

Tips for customizing the appearance of an HTML dropdown menu

Here is the code snippet: <select name="xyz" id="abc"> <option value="x">10/Page</option> <option value="y">20/Page</option> <option value="z">30/Pa ...

Sending information to the styles feature in Angular 2

Is there a way to transfer data from an Angular tag to the styles in the @Component? Take a look at my component: import { Component, Input } from '@angular/core'; @Component({ selector: 'icon', template: `<svg class="icon"> ...

Aligning a collapsible feature while ensuring that the content descends

My dilemma involves a centered menu with a dropdown feature. The issue arises from the absolute positioning, causing the entire menu to shift upward when the dropdown is activated due to the increased height. I am struggling to find an effective solution ...

Having difficulty changing the background color to black for the parent div that houses multiple child divs

Here is an example without the height attribute provided: http://jsfiddle.net/karthik64/pFcpX/ And here it is with the height attribute included: http://jsfiddle.net/karthik64/pFcpX/1/ The issue arises when I try to set a fixed 'height' attribu ...

Retrieve the image and insert it using an img tag

Working on a project, I want to include Instagram profile pictures by embedding them. Although I have the image URL, I am struggling to integrate it into my HTML page. Take a look at this sample: This provided link displays the Instagram profile picture. ...

Confirm that the CSS syntax is valid

Is there a way to validate CSS syntax by checking for specific characters like "{", "}", ";", and ":"? I have come up with four checks to ensure the code is valid, such as verifying that the number of opening and closing curly braces match, as well as the ...

CSS Trick: How to Clear Content in a 3-Column Div arrangement

I've been struggling to clear the content below my three div columns, each consisting of a span with centered text and a textarea. It seems that the issue arises from the floating div tags without proper clearing. When viewed in Firefox, the next ele ...