Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
121 views
in Technique[技术] by (71.8m points)

html - Change the number size, of input type="number"

I read a lot about changing the size, but all the options, affects the size of the input box.

I have this

input[type="number"] {
width:5rem;
font-size:100px;
}
<div class="introData">
  <label for="introData" class="label">Introducir los segundos que se mostrará cada palabra</label>
  <input type="number" name="introData" id="inputData" style="font-size: 10px;"></input>

  <button id="start" type="submit" class="btn">
    start
  </button>
</div>
question from:https://stackoverflow.com/questions/65929650/change-the-number-size-of-input-type-number

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You have style="font-size: 10px;" as an attribute in that input tag in your HTML. Inline styles overwrite external CSS. Just erase that and it works as desired:

input[type="number"] {
width:5rem;
font-size:100px;
}
<div class="introData">
  <label for="introData" class="label">Introducir los segundos que se mostrará cada palabra</label>
  <input type="number" name="introData" id="inputData">

  <button id="start" type="submit" class="btn">
    start
  </button>
</div>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...