When you hover over the button, it transforms by changing its font weight and removing its border

I attempted to enhance the appearance of a button by removing its border and making the font bolder. I used this simple CSS code:

.button {
...
font-weight: 500;
border: none;
}

.button:hover{
font-weight:600;
border: 1px solid red;
}

However, instead of the desired outcome, I encountered this result: https://i.sstatic.net/U1eAt.gif

Can anyone provide an explanation and solution for this issue?

Answer №1

To prevent this issue, adjust the width setting.

.button {
  font-weight: 400;
  background-color: #ea0c54;
  color: #ffffff;
  padding: 10px 20px;
  transition: .3s;
  width: 150px;
  border: 1px solid transparent;
  border-radius: 10px;
 }
 .button:hover {
  font-weight: 600;
  border: 1px solid red;
 }
<button class="button">Hover Me</button>

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

Using `ngRepeat` on a different array of values for repetition

Working with AngularJS. Here is an example of a JSON object: "skills": { "Charisma": {}, "Dexterity": { "Sk3": [ [ true, true, true, true, false ], 44 ] }, ... And the corresponding HTML: <div class="pan ...

Transform PHP array into a JavaScript array

Currently, I am using Laravel and retrieving a list of values from a database with the following code: $idordenes = DB::table('ordenes')->select('id')->get(); Upon echoing the idordenes variable, the output is as follows: [{"fa ...

The Bootstrap 3.3 Carousel is stationary and does not rotate

I am facing a challenge with implementing a Carousel using Bootstrap version 3.3.7 on my website. The code snippet is as follows: <!-- Carousel ================================================== --> <div class="row dark-start d-none d-lg-block"&g ...

When clicked on, Bootstrap creates a stylish border of blue lines around the designated

Hey there, I've noticed a strange issue that only seems to occur in Google Chrome on both desktop and mobile devices. To better illustrate the problem, I have attached a picture. A blue line unexpectedly appears when I interact with certain sections ...

The outer DIV will envelop and grow taller in conjunction with the inner DIV

Could use a little help here. Thank you :) I'm having trouble figuring out how to get the outer div to wrap around the inner div and expand upwards with the content inside the inner editable div. The inner div should expand from bottom to top, and t ...

What is the process for adjusting the color of the browser tab?

My chat application is running smoothly, but a client has requested the ability to highlight or make the browser tab blink when they receive a visitor call. This will help them respond promptly to incoming inquiries. Does anyone know how to implement thi ...

Moving Image Progress Indicator

I am currently developing a progress bar animation that is designed to animate from 0 to a specified percentage when the progress bar becomes visible within the browser's viewport. The animation must always trigger when the element is scrolled into vi ...

Embarking on the journey of transitioning code from server-side to client-side

Currently, I am looking to transition the code behind section of my asp.net web forms application to client-side ajax or javascript - still deciding on which route to take. The main goal for this change is to ensure that the application remains functional ...

What is the best way to access and compare the values within each <td> element?

, my code looks like this: <table id="table_append"> <tr class='text-center'>" + <td>1</td> <td class="codeverify">025</td> <td> Data1 </td> </tr> ...

I'm looking to adjust the position of an image inside a div without affecting the position of the entire div

When creating a horizontal navigation bar with an image, I encountered an issue where the image link did not align with the rest of the links on the navigation bar. I wanted to drop it down by a pixel or two without affecting the position of the other link ...

Incorporating intricate HTML elements through a Chrome content script

Currently, I am utilizing Chrome extension's content script to generate a sophisticated display that is incorporated into web pages. Initially, I tested it by integrating it directly onto a website, but now I want to package it in an extension. The ...

Having trouble with your contact form and not getting it to work properly with Javascript, Ajax, or

I've been struggling to get a contact form working for an entire day. I included the following script at the top of my page: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> This is the structure ...

Is there a way for me to retrieve the value from an input, round it up to the nearest even number, and assign it to a new variable?

I am working on a project that involves two text boxes and a drop-down menu for providing rates. The values in the text boxes are given as inches. I want these inputs to be taken as values, rounded up to the next even number, and then set as variables. How ...

How can I dynamically assign a variable to the ID of a <div> element in a Django template?

Discovering the world of Django template language has been quite an interesting journey for me, especially as I experiment with bootstrap collapses to showcase my items. Let's take a look at the code snippet below: {% for item in items %} <div id=& ...

Flow bar for micro-tasks

In my current project, I am faced with the task of organizing a series of 4 mini tasks and displaying to the end user which specific mini task they are currently on. To accomplish this, I have been utilizing image tags for each task. <img>1</img ...

What is the best way to expand this HTML5 canvas script to fill the entire screen?

I am having issues adjusting the canvas to fill the entire window. Currently, it is set to 500x500. As a beginner in coding, any assistance would be greatly appreciated! Thank you. Below is the code snippet: <!DOCTYPE html> <html> <head& ...

What is the best way to add an element while preserving its original placement?

I need a solution to duplicate the code of an element and transfer it to another element without removing it from its original position. Currently, I have a JavaScript function that allows you to move a picture to a box when it's clicked. However, th ...

Using elements and querySelector in VueJS is not effective

After successfully creating HTML elements using JavaScript, I attempted to convert the code into VueJS. However, upon loading the page, I noticed that the elements were not being created. HTML <div id="chat" class="chat-size col-centered margin-btm-50 ...

Struggling with adding information to chat page using PHP

Hey there, I've been working on developing a chat page that connects to a database using PHP. Here's an example of the SQL query I'm using: $sql = "SELECT message, ticketid, Sender FROM Messages WHERE ticketid = '$id' "; I have ...

difficulty in obtaining information submitted through a form

I'm having an issue with my contact form. I tried testing to see if I can retrieve the values from the form, but it's giving me back: name: undefined I'm not sure why it's not working! Here is the code for the form: <form met ...