Answers for "auto adjust div size to content"

CSS
0

how to make div width auto adjust

.center {
  display: inline-block;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}
Posted by: Guest on November-28-2020
0

make div' width expand with content

<div id="container">
  <p>Sample Text 1</p>
  <p>Sample Text 2dddddddddd</p>
  <p>Sample Text 3</p>
</div>
Posted by: Guest on June-11-2021

Browse Popular Code Answers by Language