skip to Main Content

I need CSS help on formatting this BID VALUE text box (input element) (See in Picture 1)
Picture 1
enter image description here
Product link is here

When I make text box wider via Padding the text value inside the box is disappearing (Get hidden probably) I can’t find where I’m doing wrong.

I have duplicated them so you can understand my problem, If you look on the photo above I have labeled Number 1 & 2, they both have same ID and other properties BUT

BID VALUE Number 1 have the following custom CSS

input[name="bid_value"]
{
  width:auto;
  padding: 4px 120px 5px 31px;
  margin: 2px 11px;
  box-sizing: border-box;
 text-align: left;
    
}

BID VALUE Number 2 doesn’t have any custom CSS its by default that way, It does not show the current BID VALUES clear (all value figures) that’s why I want it to be a little big but if i do that (referring BID VALUE 1) the value is disappearing, Any advice on where I’m doing wrong?

I wish my BID VALUE text box above to be like this format here in Picture 2
enter image description here
Its link is here

Looking forward to hear from you guys on what I am doing wrong.

2

Answers


  1. If the L/R (width) padding leaves no room for the text at the chosen font size, the text will not be displayed.

    const $ = document.querySelector.bind(document);
    let pwid = 10;
    $('button').addEventListener('click', () => {
      pwid = pwid += 20;
      $('input').style.paddingLeft = `${pwid}px`;
      $('input').style.paddingRight = `${pwid}px`;
      $('aside').innerHTML = `Control Width: 130px<br>L/R Padding: ${pwid}px`;
    });
    input{width:130px;padding:10px;box-sizing:border-box;margin-bottom:20px;}
    button{padding:7px 10px;background:#ccc;border:1px solid #ccccccCC;border-radius:4px;cursor:pointer;}
    <input type="text" value="Merry Christmas" />
    <div><button>Add 20px to Padding Width</button></div>
    <aside></aside>

    Solution: Use font-size instead of padding to make the text easier to see. If the input field is not growing with the text, then change the width and/or max-width values on the input (text) box to be either "auto" or "unset".

    Login or Signup to reply.
  2. If you insist on using width: auto, add !important to overwrite existing CSS (i.e. width: 3.631em; in a rule for .woocommerce .quantity .qty), otherwise your padding will fill the whole input field.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search