0

I have a div with nothing to set the width of the doc except for an <input type = “text”/> that input has css set to width: 90%; font-size: 3rem: this makes the doc 485px wide, and the input 90% of that. I want to know if there is a way to know the width of an input bar? I am assuming if no parent container has a width set that it sets itself to (10*font-size)rem, as I think that a rem is around 16px. But I know that if the div has a width set that the input would then be whatever percentage of the parent. I can’t find the info on the internet. Thanks.

BobbyOrr4
  • 352
  • 5
  • 14
  • 1
    You'll probably need to use JavaScript to get the actual width of the element. Might take a look here: https://stackoverflow.com/questions/294250/how-do-i-retrieve-an-html-elements-actual-width-and-height – Nathan Champion Jul 18 '20 at 22:50
  • Thanks but I know the exact width is 485px. Just wondering how that’s generated. – BobbyOrr4 Jul 18 '20 at 22:52

0 Answers0