The list is shifting unexpectedly as the font size transitions

Hey guys, I've created a cool interactive design with six boxes that increase in font size when hovered over. However, this causes the boxes to move around, as you can see in my example. Any suggestions on how to fix this issue?

Another thing I noticed is that the border size appears to be thicker where two boxes meet. Is there a way to make the touching sides overlap, without using negative margins (which could get messy when resizing the screen)?

Thanks in advance for any help!

Check out my code here

#main-content a {
color: #000;
border: #000 solid 2px;
display: table-cell;
text-align: center;
vertical-align: middle;
text-decoration: none;
-webkit-transition: font-size ease 3s, background-color ease 0.7s;
-moz-transition: font-size ease 3s, background-color ease 0.7s;
-o-transition: font-size ease 3s, background-color ease 0.7s;
transition: font-size ease 3s, background-color ease 0.7s;
}

Answer №1

font-size is the culprit in this case, and I suggest using transform: scale() instead of font-size. In my opinion, using font-size for this purpose is not a good idea, and utilizing transform scale would be more effective. I have made some modifications to your fiddle.

#main-content a:hover {
    background-color: rgba(255, 0, 0, 0.5);
    transform: scale(1.5);
}

Check out the updated jsFiddle here

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 troubleshoot an unresponsive button element to determine the listeners it has?

In a previous situation, I encountered an issue with the event modifier of a nested b-input not working as expected. To resolve this, I had to add .native because I was interacting with a component: b-dropdown(text="Actions") b-drop ...

Tips for retrieving HTML code from a URL after JavaScript has loaded

I am currently working on developing an app that retrieves data from a website. Unfortunately, the website does not offer an API for this purpose, so I decided to create my own solution. Here is the issue at hand: I have written the following code to extr ...

Enhance your navbar with interactive image effects on hover

Looking to create a CSS menu that changes images and background when hovered over. Below is the code for my menu: HTML <ul> <li class="active1"> <a href="profile.html" class="act">My Profile</a></li> <li><a ...

What are the steps to connecting incoming data to an Angular view utilizing a reactive form?

Hello, I am currently fetching data from an API and have successfully displayed the teacher values. However, I am unsure of how to utilize the incoming array values for "COURSES" in my Angular view. This is the response from the REST API: { "courses ...

Struggling to locate element using Selenium in Python 3?

While using Selenium for WebScraping, I've encountered difficulty detecting an element using xpath, full xpath, id or text. <div id="cbp-vm" class="cbp-vm-switcher cbp-vm-view-list"> <div class=cbp-vm-options">...& ...

Struggling with uploading an image in a react application

Hey everyone, I'm encountering some issues with importing images into my project. Previously, I was able to import images successfully in my old project using the same method that worked before, but it's not working this time around. The way I im ...

Is there a way to gather information from a web service and neatly display it within an HTML table?

Is it possible to fetch a JSON array from a web service and save it in a variable? Consider the following table structure: <table id="myTable" border="1"></table> The table is populated using the code below: // JSON array var myData = metho ...

Concealing specific DIV elements (unfortunately not nested)

Currently, I am dealing with pre-existing code that is automatically generated and needs to adhere to a specific format: <div id="TITLE1"></div> <div id="div-1"></div> <div id="div-2"></div> <div id="div-3"></d ...

Tips for removing borders around a textbox with a background image: When incorporating a background image into a

After removing the default borders on a textbox using outline:none;, I noticed that adding a background image caused the border to reappear, and I couldn't get rid of it! How can I solve this issue? Here is the code for the textbox: <input type = ...

Show a picture upon hovering the button

Welcome to my website. My goal: Show an image when a user hovers over the links. I must be making some silly error, but I can't pinpoint it. This is what I've attempted so far: HTML <ul class="nm"> <li><a href="#">Cork& ...

Discovering the information lined up in a single row

The row consists of: Row Number -- Name Surname -- Instructor Name -- Grade </tr> <tr height=20 style='height:15.0pt'> <td height=20 class=xl6429100 align=right width=28 style='height:15.0pt; border-top:none;width:21pt&apo ...

prohibit magnifying glass from appearing on iOS 9 in a meteor cordova application

https://i.sstatic.net/jQOpS.jpg I have been experimenting with various solutions to get rid of the intrusive magnifying glass using CSS. Interestingly, on my iOS9 meteor cordova build, it still briefly appears and then disappears after a few milliseconds. ...

Manipulating visibility of an input tag using JQuery

Having a simple input tag: <input id="DAhour" type="number" style="width:50px; font-size: xx-small; visibility:hidden"> Initially, the input tag is set to be hidden. Upon changing a combobox to a specific index, it should become visible. Despite su ...

What is the best way to include a select HTML element as an argument in an onSubmit form function call?

I am currently facing an issue where I am attempting to pass HTML elements of a form through the submit function as parameters. I have been able to successfully retrieve the nameInput element using #nameInput, but when trying to access the select element ( ...

Using django compressor and clevercss to optimize CSS files with absolute URL paths

When working with django, compressor, and clevercss, I encountered an issue regarding the use of absolute versus relative paths for my css files. When I specify an absolute path for my css url, clevercss is unable to process the .ccss file without the COMP ...

Submit Button Field - HTML ButtonFor

Being relatively new to MVC Razor and web development, both front-end and back-end, I'm in need of a button that can send a stored value to the controller/model. I attempted to mimic the functionality of Html.TextBoxFor by giving it attributes similar ...

Creating submenus that cause the navigation menu to drop down

I created a basic navigation bar using HTML Lists. The initial structure looks like this: <div id="menu"> <nav> <ul> <li><a href="#">My Profile</a></li> <li><a href="#" ...

Is there a way to reuse a JSP chunk that is defined within a JSP page without the need to create a separate JSP

I need to streamline 14 sections of code scattered throughout JSP, causing repetition: <div> <table> <tbody> <tr> <td><spring:message code="economy"/></td> <td>${spm}< ...

XPath allows for the selection of both links and anchors on a webpage

Currently, I am using Screaming Frog and seeking to utilize XPath for a specific task. My objective is to extract all links and anchors that contain a certain class within the main body content, excluding any links found within div.list. I have attempted ...

Altering the color of text in hyperlinks within a list

Recently, I've started exploring CSS styling and I'm curious if there is a more effective way to change the color of link text when they are within a list. Currently, all my links have the same color and I'd like to enhance this aspect. < ...