The CSS property input::-webkit-outer-spin-button adjusts the margin-left and is exclusively visible in Chrome browser

Strange things are happening...

Let me share the code for my inputs:

#sign_in input#submit {
    height: 56px;
    background-color: #88b805;
    font-weight: bold;
    text-decoration: none;  
    padding: 5px 40px 5px 40px; /* top, right, bottom, left */   
    border: 0;
    width: auto;
    -moz-border-radius: 25px;
    -khtml-border-radius: 25px;
    -webkit-border-radius: 25px;    
}

#sign_in input#submit:hover {
    -moz-box-shadow: 5px 3px 5px rgba(0,0,0,.5);
    -khtml-box-shadow: 5px 3px 5px rgba(0,0,0,.5);
    -webkit-box-shadow: 5px 3px 5px rgba(0,0,0,.5); 
    cursor: pointer;    
}

input, textarea {
    font-size:20px; 
    display: block; 
    width: 365px; 
    height: 40px; 
    background: #273243; 
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px; 
    color: #ffffff;
    /* margin: 0 0 0 100px;     top, right, bottom, left */ 
    padding: 5px 5px 5px 15px; /* top, right, bottom, left */
    border: 0px;
}

input:focus, textarea:focus {
    background: #313131;
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px; 
} 

My current dilemma involves the submit button:

<div id="sign_in" align="center">

<form>
        <input id="name" type="text" value="Email address" required class="clearField curved" /> <br />
        <input id="password" type="text" value="Password" required class="clearField curved" /><br />   
        <input id="submit" type="submit" value="Log in" class="curved" align="center">
    </form>

</div>

Interestingly, despite setting the div to align=center, everything is centered in Chrome except the login button.

On another note, Firefox and Safari on Mac display it correctly. The hiccup seems to be limited to Chrome in both Windows and Mac operating systems where the submit button appears too close to the left margin.

Upon inspecting developer tools in Chrome, I noticed something unusual:

input::-webkit-outer-spin-button {
-webkit-appearance: outer-spin-button;
-webkit-user-select: none;
display: inline-block;
margin-left: 2px;
}

The margin-left being set to 2px caught my attention. Perhaps targeting this specific pseudo-class could override it – a hackish method that I haven’t tried yet. Is there another way to resolve this quirk without resorting to such tactics?

What's causing this misalignment, and how can I rectify it? My goal is to have the button centered.

Edit: I attempted to target the specific Pseudo selector by adjusting the margin, but no changes took effect. Even with margin-left set to 150px, the layout of the button remained unchanged. It’s puzzling why this isn't working as expected.

Answer №1

It is advised to eliminate the "align=center" attribute from your div element.

#log_in {
    width:760px;
    margin:0 auto;
}
#log_in input#submit_button {
    height: 46px;
    background-color: #37a412;
    font-weight: bold;
    text-decoration: none;  
    padding: 5px 35px 5px 35px; /* top, right, bottom, left */  
    border: 0;
    -moz-border-radius: 20px;
    -ms-border-radius: 20px;
    -webkit-border-radius: 20px;    
}

#log_in input#submit_button:hover {
    -moz-box-shadow: 4px 2px 4px rgba(0,0,0,.7);
    -ms-box-shadow: 4px 2px 4px rgba(0,0,0,.7);
    -webkit-box-shadow: 4px 2px 4px rgba(0,0,0,.7); 
    cursor: pointer;    
}

input, textarea {
    font-size:18px; 
    display: block; 
    width: 335px; 
    height: 38px; 
    background: #245356; 
    -moz-border-radius: 8px;
    -webkit-border-radius: 8px; 
    color: #ffffff;
    padding: 5px 5px 5px 13px; /* top, right, bottom, left */
    border: 0px;
    margin:0 auto;
}

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

Full-width Dropdown Menu within a Container with a Maximum Width

Is it possible to make a dropdown menu within a navigation bar open to the full width of the page, even when the parent container has a maximum width of 500px? My attempt to use 100vw resulted in misaligned dropdown elements, and I cannot move the navbar ...

What's the best way to get rid of the one-pixel gap between these elements on high-resolution displays like

http://jsfiddle.net/36ykrp9x/5/ HTML <div class="container"> <button>O</button><button>O</button> </div> CSS .container { width: 100%; background-color: rgb(120, 200, 200); text-align: center; } butt ...

How can I locate specific images within a CSS sprite?

Are you searching for the correct process to pinpoint specific image locations within an image sprite? If, for example, you aim to create 10 div images in your header using the image provided below, how can you determine the exact location of each one? Is ...

When the window is resized, the div shifts position

I recently added a div to my website with the following code: <div id="div"></div> #div { height: 400px; width: 300px; position: absolute; right: 59%; text-align: left; } Howe ...

The appearance of responsive CSS is altered when deployed compared to when it is viewed on the

I'm a beginner in web development and facing an issue with my mobile CSS. The strange thing is that when I view it on localhost, everything looks great, but once deployed (tried both Heroku and GitHub), it appears distorted. Even when I make extreme c ...

Adjusting the margin on an element causes a shift in the entire page's

Why is the margin of an h2 element on my page displacing the entire body downward? This seems abnormal since the h2 element is within a div container. Is there a way to address this issue? ...

Adding a scrollable feature to a Bootstrap Modal seems to be generating additional unnecessary pages at the

I need help with my scrollable bootstrap modal that has a print button on top. When the user clicks the button, I want to print the modal content. Here is the code snippet: HTML : <div class="container-fluid" id="body-noPrint"> /* HTML BODY CON ...

Animation in CSS3: Blinking overlay block

I am interested in creating an element that will overlay a section of a webpage using position: absolute. The element should be 50% opaque and blink between red and transparent, similar to the way OSX used to do with default dialog buttons. Is there a way ...

Having trouble with jQuery toggle fade: Unable to make the div fade in/out when toggling

Is there a way to modify the functionality of my black button so that when clicked, the red div fades out while the blue div fades in? Right now, clicking the button switches between the two divs without any fading effect. Fiddle: http://jsfiddle.net/ddac ...

Ensure the div remains fixed in its position regardless of the page's height

I am seeking assistance with making two divs of equal height on my website. The left div contains dynamic content that may expand vertically with various inner divs. Meanwhile, the right div has a single inner div that should remain visible at the top ev ...

Adding space between the heading and the text underneath by placing a margin between h2

I am dealing with a situation where I have an <h2 class="landing-panel-title> containing a <span class="landing-panel-icon-right ion-ios-search-strong>. The second class on the span is from an icon font called ionicons. Despite this, it may not ...

Having trouble importing from the public folder in CSS with Create React App?

While working on a project initialized with Create React App, in the public folder there is an assets directory containing a file named logo512.jpg. When I use this file in a component like so: <div> <img src='/assets/logo512.jpg'/& ...

Guide on making a prev/next | first/last button functional in list.js pagination

Is there a way to enhance my paginated index by adding prev/next, first/last buttons? I am curious if anyone has implemented these features using List.js. <script src='//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js&ap ...

Using HTML and CSS to stack a DIV on top of another using z-index

I have 3 main layers on my website: 1) The main view with elements inside (#views in jsbin) - BOTTOM LAYER 2) An overlay (with a white background opacity of .8 #overlay in jsbin) - MIDDLE LAYER 3) A context menu (#contextmenu in jsbin) - TOP LAYER Wh ...

OptinMonster's innovative feature - the Pardot form with an inline button

Having trouble integrating an HTML Pardot form into OptinMonster's floating footer option. I'm looking to align all three fields inline, along with the button. Can anyone assist me in placing the button inline with the fields? HTML: <fo ...

Eliminate any iframes that have a src attribute with the value of "some_src.com/....."

I'm brand new to coding in javascript. I've noticed that there is an annoying ad popup that manages to sneak through Adblock super without being detected. It's driving me crazy and I want to block it! Here's the code for the iframe: IF ...

Tips for personalizing and adjusting the color scheme of a menu in ant design

I am currently working on a website using reactJs and ant design. However, I have encountered an issue with changing the color of a menu item when it is selected or hovered over. Here's the current menu: Menu Image I would like to change the white col ...

Utilizing Javascript to implement a tooltip feature for dynamically inserted text

I recently incorporated a brief jQuery tooltip plugin into my site. It consists of approximately ten lines of code and works smoothly, as demonstrated in this demo. However, I encountered an issue when attempting to add new text that should also trigger t ...

Guide to setting up a custom js file in Laravel admin template

Currently working with Laravel 5.8 and utilizing the laravel-admin Template for administrative purposes. There are times when I require custom JavaScript and CSS files specifically for certain admin controllers. How can I include these JS and CSS in lara ...

Adjusting the width of columns in a table

Previously in Bootstrap 3, I was able to use col-sm-xx on the th tags within the thead to resize table columns as needed. However, this functionality is no longer available in Bootstrap 4. How can I achieve a similar effect in Bootstrap 4? <thead> & ...