Home > database >  Scale border width depending on text length
Scale border width depending on text length

Time:05-11

im learning css and not very good at it at the moment. Is there a way to scale the border width depending on the text width as a user could input a short name or a long one. This is the CSS of the border. Thanks for any help in advance.

#summonerInfo{
  border:2px solid black;
  margin-left: 25%;
  width: 50%;
}

enter image description here

CodePudding user response:

set width to auto; width:auto; it will try to keep the contents inside the allocated box.

  •  Tags:  
  • css
  • Related