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

Exploring jQuery Animation Effects: Enhancing Your Web Experience with Zoom In and Zoom Out

Is there a way to animate a logo using jQuery automatically upon page load? I want the image to zoom out, then zoom in and change to a different image. Can someone please assist me with this task? Below is the code snippet that I have: $(document).ready ...

Issues with JQuery .attr method not functioning as expected

I'm having trouble with the .attr() function in jQuery. It doesn't seem to be changing the background-color of the div with the id "outline" like I expected. Here's an example of my code: <div id="outline"></div> And here is t ...

I am looking to place two HTML buttons next to each other on the same line

I am trying to display two HTML buttons next to each other on the same line, with the "Submit Request(s)" button appearing first. The issue I am facing is that the top of the second button aligns with the bottom of the first one. The second button is cor ...

Choosing <label> elements, while disregarding those <label> elements that include <input>

I need assistance with CSS rules to target only <label> elements that do not contain an <input> field inside of them. Is there a specific rule I can use for this? <label for="type">Regular Label</label> <label for="type"> ...

Can anyone provide a reference or resource that explains the best scenarios for utilizing display:block, display:inline, and display:inline-block, and the reasons behind their usage?

Can you recommend a quality article discussing the guidelines for using display:block, :inline, and :inline-block in CSS, along with explanations on when to utilize each one? Additionally, in what scenarios should we override the display property through ...

Using jQuery, organize tables by the value of their td class

, I am attempting to organize various td elements within one or more trs based on their respective classes. These are all housed in multiple table elements with the classname "hosts". Currently, my jQuery abilities are lackluster and I am struggling to sor ...

Tips for organizing the contents of nested items in alignment

Here's a layout I've created, you can view it on CodePen. .parent { display: flex; justify-content: space-between; } .left { flex-grow: 1; flex-basis: 0; background-color: blue; } .right { background-color: red; flex-grow ...

Adjusting the height of flex items to 100%

I'm currently diving into the world of flexbox by exploring various tutorials. Here's an example I created without utilizing Flex. Instead, I relied on float:left. Check out the example: https://jsfiddle.net/arhj8wxg/4/ I attempted to convert t ...

Trouble with buttons in table cells

There is a problem with a button placed in a table cell that spans two rows and does not fill the second row. How can I ensure that this button fills both rows? I have attempted to adjust the height in the button's style as well as in the table cell i ...

When you click on the collapsible header background, the content collapses, but the main icon does not update

I am currently using collapsible content from Bootstrap and I am encountering an issue with the icon not changing when I click on the collapsible-header background. Here is a visual representation of the problem: 1st part (not collapsed) 2nd part (After ...

Sort slider items using Show/Hide feature in bxSlider

I am using a bxslider on my website with specific settings: $('#carousel').bxSlider({ slideWidth: 146, minSlides: 2, maxSlides: 6, speed:500, adaptiveHeight: true, moveSlides:3, infiniteLoop : false, hideContr ...

Unusual phenomenon in ASP.NET: Adding Debug=true in the web.config file results in CSS modifications

As the question suggests: After including debug=true in my web.config file (without making any other alterations to the code), my page is displayed without a background color. Can anyone shed light on why this might be happening? ...

Tips for using jQuery to slowly change a CSS property to "auto"

I've encountered a situation where I have an element styled with position:fixed, and bottom: auto;. When I apply the command .animate({bottom : '10%'});, it smoothly slides to the specified position. However, when I try to set it back to its ...

What is the best way to hide the select arrow in an input-group using Bootstrap 4?

Is there a way to get rid of the unsightly double arrow in the select element? I have tried various solutions I found online, but none seem to be effective. <div class="form-group"> <label for="date">Date</label> <d ...

Is it possible to apply CSS to only the first element?

I have designed a pricing form like the one shown below: To view a full page version of my code for easier reading, please click on the link provided. @import url('http://fonts.googleapis.com/css?family=Indie+Flower'); @import url('http: ...

How can input be fixed in place within a list inside an Ionic framework popover?

I have the following code in a popover template: <ion-popover-view class="customPopup"> <ion-header-bar class="bar bar-header barHeaderCustom"> <h1 class="title">{{ 'AVAILABLE_SOUNDS' | translate }}</h1> </io ...

Issue with relative input causing Jquery click event to not fire

Jquery $(document).on("click","[type=text]",function(event) { alert('test'); }); CSS .noWorking:focus{ z-index:100; position:relative; outline:none; box-shadow:0 0 0 1000px rgba(0,0,0,.2); } To ensure the shadow appears on top of all oth ...

Update the parent node in the Google Org Chart

This is my first time working with Google Charts and I have a couple of questions: Is there a method in the API to update the parent of an existing node? I am facing a challenge where I need to build a tree structure top-down, which means that I know the ...

I am interested in updating the color of the navigation bar displayed on this website

I am having some trouble with manipulating the appearance of - Specifically, I'm struggling to change the color of the black bar at the top to blue. I have scoured the CSS files and examined the HTML, but I can't seem to locate the relevant code ...

Effortlessly switch between CSS animation styles while adjusting animation settings

My HTML element with animation is defined as follows: <div id="box"></div> The box starts by moving 200 pixels to the right, taking 4 seconds to complete. .anim { animation-name: anim; animation-duration: 4s; animation-t ...