Google Chrome's number input type trims its rendering

When using the number input type in Chrome, the appearance of the input boxes is different, with the numbers appearing bottom-trimmed. Is there a way to fix this issue without adjusting the size of the input controls?

Any assistance would be greatly appreciated.

Check out the jsFiddle demonstration here

https://i.sstatic.net/P9fTq.jpg

In contrast, both text and number inputs display with the same visual appearance in Internet Explorer.

<div class="container">
    <div class="small">
    <input type="number" placeholder="Number"  value="8" class="form-control  input-xs">
        <br/>
    <input type="text" placeholder="Text" value="8" class="form-control  input-xs">
   </div>
</div>

input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance:textfield;
}
.input-xs {
    height: 22px;
    padding: 5px 5px;
    font-size: 10px;
    line-height: 1.5;
    border-radius: 3px;
}

Answer №1

The input-xs class is being affected by the line-height property. Removing it solves the issue, suggesting that not all browsers support line-height for input elements.

According to reports, while Chrome and Safari apply line-height values to inputs, Firefox, Internet Explorer, and Opera do not follow this behavior.

Source Found Here...

.input-xs {
    height: 22px;
    padding: 5px 5px;
    font-size: 10px;
    /*line-height: 1.5; or set to 'line-height: 1'*/
    border-radius: 3px;
}

Check out the Fiddle 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 procedure for a parent component to transmit HTML to a child component within Angular?

How can a parent component pass multiple ng-templates to a child component? For example, the parent component includes multiple ng-templates: <app-childcomponent> <ng-template>Item A</ng-template> <ng-template>Item B</n ...

Invoke the mounted lifecycle once more

At the moment, my table is set up to use the v-for directive to populate the data: <table v-for="(data, idx) in dataset" :key="idx"> </table> Following that, I have two buttons that perform actions in the database, and I wa ...

Manipulating Objects with CSS Transform in Global/Local Coordinates

If we take a closer look at our setup: <div id="outside"> <div id="inside">Foo</div> </div> and apply a rotation to the outer element - let's say turning it 45 degrees clockwise: <div id="outside" style="transform: ro ...

Showing child elements within a div using AngularJS

I am eager to create a straightforward AngularJS website that will showcase an initially hidden HTML element along with all of its children. Below is the HTML structure snippet I plan to use: <div class="hiddenStuff"> <h3>Game Over</h3&g ...

JavaScript random number functionality experiencing an unexpected problem

function generateRandomNumbers(){ var max = document.getElementById('max').value; var min = document.getElementById('min').value; var reps = document.getElementById('reps').value; var i; for (i=0; i<reps ...

Fading effect of Bootstrap JS on reducing content size

My quest for a toggle collapse button led me to this helpful link: https://getbootstrap.com/docs/4.0/components/collapse/ I found what I needed, but encountered an issue with the transition; clicking on the button immediately reveals my div. I desire a slo ...

Tips for resizing a Shiny Dashboard to accommodate various screens

I created a shiny app with a specific layout on my desktop computer that fits perfectly on the screen. However, when I run the app on my notebook, only the top left boxes are visible, making the app too large for the screen. Even after resizing with Ctrl ...

Use ng-class in a P tag to assess a variety of expressions

Is there a way to apply ng-class to automatically evaluate negative values within a < p > tag? <p <strong>LW$:</strong> {{d.lw_metric}} <strong>LW:</strong> {{d.lw_metric_percentage}} <strong>L4W:</strong> {{ ...

Utilize CSS to selectively target specific sections of a repetitive pattern within a list

I have come across a list fragment that is generated automatically and I only have the ability to adjust the CSS for it. <ul class="menu"> <li class=" menuItem1 first parent"></li> <li class=" menuItem2 parent"></li> ...

Update the chosen option of the <select> element that was generated through PHP if there is a parameter value present in the URL

I'm currently working on a code snippet like this: <select name="id" id="id"> <OPTION VALUE="null">Select<OPTION> <? foreach ($genres as $row){ ?> <OPTION VALUE="<? echo $row->id; ?>"><? echo ...

Utilizing jQuery for various dynamically generated HTML elements

I am currently working on a form for editing data in my database. The form consists of three dropdowns: Category, Subcategory, and Item. These dropdowns are dynamically populated based on the selection made in the previous dropdown. After all three dropdow ...

Display solely the initial row in the tbody segment of a table. Is there a method to obscure subsequent 1st rows?

The initial row of each tbody acts as the row header, containing the column names. Subsequent rows in each tbody are unnecessary and should be hidden. Classes utilized: toprowHeader = first row containing column names recordsRow = holds additional recor ...

Support for other languages in Laravel with the Dompdf package

I utilized the dompdf package in my Laravel project to generate a PDF file. However, when attempting to display content in a language other than English (like Bangla) ??????????????????????????? characters appear. <body style="font-family: 'Ador ...

Revive the design of a website

As I work on creating my own homepage, I came across someone else's page that I really liked. I decided to download the page source and open it locally in my browser. However, I noticed that while the contents were all there, the style (frames, positi ...

Tips for running multiple JavaScript functions in ASP.NET using Button's OnClientClick property

Is there a way to execute multiple JavaScript functions in ASP.NET to perform various tasks such as inserting a desired text in a TextBox, changing the TextBox background color and font color, and disabling or locking a Button for a specific duration? I ha ...

Ways to adjust the content width within an iframe without altering the iframe's overall width

I need help with adjusting the width slider in my iframe. I want the width slider to control the content width within the iframe, not the actual width of the iframe itself. Essentially, I want to switch between mobile and desktop mode by resizing the con ...

The marquee HTML code is not functioning correctly in the Chrome browser

<marquee behavior="scroll" scrollamount="2" direction="right" width="70%" style="background-color: transparent; height: 18px;" onmouseover="this.stop();" onmouseout="this.start();"> 1 2 3 4 5 6 7 //inside html </marquee> Th ...

A unique feature where a bar emerges from the bottom of the screen, smoothly glides upwards, and then securely fastens to

I'm working on bringing to life a concept that I've been envisioning. The design would feature a long scrolling page with a unique navigation bar behavior. The idea is for the navigation bar to initially start at the bottom of the screen and the ...

What could be the reason for my new course not being recognized?

Looking to modify the behavior of a button where, when clicked, it hides a specific div element, changes its text display, and toggles between classes using addClass/removeClass for subsequent click events. Unfortunately, the intended functionality is not ...

Should I create CSS rules for different screen sizes or should I dynamically render components based on the screen size?

As I delve into learning React, I find myself unsure about the most effective approach to make websites responsive. Currently, I am utilizing Semantic UI React as my CSS Library. While everything displays perfectly on desktop, I encounter some issues when ...