When working with a div tag, I encountered a challenge.
<div id="length"></div>
My goal is to center the contents of the div while also decreasing its width to hold a number.
#length{
background:black;
color:white;
border:3px solid grey;
width:35px;
//margin-left:655px;// Currently I am using this to center.
border-radius:50%;
}
However, adjusting the width property causes the div to lose its center alignment. Is there a way to achieve both without compromising the center alignment?