CSS Scale Transformation - Font May Change Unexpectedly

When I hover over my code, the font style changes. It seems to be related to this line of code:

font: 14px/1.6 "Open Sans",sans-serif;
. However, I need this effect. Is there another way to achieve a similar effect (scaling to 1.2) without modifying this CSS? You can view my code here.

.c-data:hover .liczba{
transform: scale(1.2, 1.2);
}

Here is my HTML:

    <div class="u-div">
        <div class="c-data">
            <span class="liczba"></span>
        </div>
    </div>

Answer №1

Check out this functional code snippet

body {
  font: 14px/1.6"Open Sans", sans-serif;
}
.u-div {
  width: 25%;
  float: left;
  margin: 10px auto 20px auto;
}
.c-data {
  display: block;
  margin: 0px auto 0 auto;
}
.liczba {
  cursor: default;
  transition: all 0.2s;
  -webkit-transition: all 0.2s;
  -moz-transition: all 0.2s;
  -o-transition: all 0.2s;
  -ms-transition: all 0.2s;
  text-align: center;
  display: block;
  font-size: 80px;
  font-weight: bold;
  line-height: 80px;
}
.c-data:hover .liczba {
  font-size: 90px;
}
<div class="u-div">
  <div class="c-data">
    <span class="liczba">6</span>
  </div>
</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

Scrolling Horizontally with a <div> containing <a> and <img> elements

I currently have a table with three columns. The third column consists of multiple images that are clickable to perform an action, so I need this column to be horizontally scrollable. To achieve this, I inserted a <div> in the third column and added ...

What is the best way to rearrange a sidebar column to be positioned between central content columns on a mobile

I am looking to design a layout with the following components: Left Sidebar Main Content Right Sidebar Extra Content My goal is to achieve the following: On larger screens: Ensure that the "Extra Content" aligns directly below the main content with the ...

Form a triangle in order to prevent the inner content from spilling out

I'm currently attempting to design a triangle shape that prevents the inner content from overflowing while still allowing the inner content to be draggable. So far, I have experimented with various solutions such as polygons and canvas, but none of t ...

How can floats be used to implement margin on a container using CSS?

I've been struggling with this issue for a long time and have yet to find a satisfactory solution, so I've decided to seek help. HTML <section class="cols-2"> <div class="wrapper"> Lorem ipsum dolor sit amet, con ...

The Bootstrap carousel spiraled into disarray

I am facing an issue with the basic bootstrap carousel. My goal is to make the slides move every four seconds. The current setup of the carousel code is as follows: $(document).ready(function() { fixCarousel(); }); function fixCarousel() { $('.c ...

Issue in Chrome where hover state does not persist after clicking, occurring sporadically

It's surprising that I couldn't find any information about this on Google. This bug is really annoying, and I'm not sure if it can be fixed without an update from Google for their browser. Description of the issue: When clicking on an eleme ...

Utilizing CSS to Display a Variety of Colors within a Text String

Is it possible to style different words in a sentence with various colors using only CSS, without using the span element? For instance, how can I make the word "Red" appear in red, "Blue" in blue, and "Green" in green within an h1 tag? ...

Creating a stylish Bootstrap 5 table featuring a large PRE block in a cell that is scrollable

I am currently working on formatting a table and I need some help figuring out how to achieve my desired layout. The issue I'm facing is with a cell that contains a large JSON object block. I want this block to either wrap within the enclosing TD, or ...

Maximizing performance with internal Bootstrap?

An interesting concept to consider is that the fastest website could actually be an empty webpage. Each additional piece of data added compromises performance, yet it's the server's responsibility to send all the code to the client. When using ...

Modifying .vue files within Laravel seems to unexpectedly impact unrelated CSS styles

I've been working on a Laravel project that involves building Vue components. Strangely, every time I update a .vue file and add it for a commit, modifications are also made to the app.css and app.js files. These changes seem to be undoing a particula ...

Positioning textboxes of varying heights in a vertical alignment, causing one to commence directly below the other

Seeking assistance with creating text boxes for displaying reviews on a website. Each review is contained in a box, with varying heights based on the amount of text. Desired layout is shown in the image below, with black boxes representing review container ...

Display the contents of a specific tab by showcasing them as its children

My goal is to create a user-friendly interface with a list of tabs, each representing a category. The content related to each tab should be displayed in close proximity to the tab itself, creating a visual hierarchy akin to parent and children. This is ho ...

Tips for constraining elements to set heights according to content in "stepped" increments

Is there a way to have "step-based heights" on a div? I created a small example to illustrate my question. My goal is to make sure that each box has a height that is a multiple of 400px. For instance, if a box with height: auto; is 345px, it should displa ...

Challenges with selecting elements using jQuery

Hey there! I've got a bit of a coding puzzle. I can successfully select a td and change the image inside it, but I also need to display the id of the selected td. The catch is that my function first has to select the image to change it. Is there a way ...

Creating divs of the same height with CSS styling

I am struggling with making 3 floating <div>s all the same length within a wrapper. The issue is that they need to be responsive and cannot have fixed heights. While researching on stackoverflow, I came across a post addressing this problem: Make fl ...

Concealing table columns using JavaScript - adapt layout on the fly

I am currently implementing a responsive design feature on my website, where I need to hide certain columns of a table when the viewport size decreases beyond a specific point. Initially, I tried using .style.visibility = "collapse" for all <tr> elem ...

Improving the style of Google Maps InfoWindows for right-to-left languages

I'm currently working on a Google Maps marker infowindow and trying to adjust the padding specifically for RTL languages. Here's what I've attempted so far: google.maps.event.addListener(marker, 'click', function () { i ...

The banner appears unusually compact when viewed on mobile devices

It's about time for me to delve into the intricacies of responsive and adaptive design, but I'm hoping there's a straightforward solution to tackle this issue. Here is my desktop web page as displayed in my browser: https://i.stack.imgur.c ...

Troubleshooting compatibility problems between jQuery UI Sortable and a responsive Bootstrap 5 page

Has anyone had experience using the jQuery UI Sortable widget on a Bootstrap 5 responsive page? My page consists of <div class="col-lg-6"> elements, displaying two per row. Although the sorting functionality works, I've encountered t ...

Energetic flair for Vue animations

I am currently developing a VueJS sidebar component. The objective is to allow the parent to define a width and display a toggle button that smoothly slides the sidebar in and out. Here is an example: <template> <div class="sidebarContainer ...