1

I am trying to insert text under an <li> tag. I made some curvy background. now my texts are going out of the border.

Link to Image

Now I want that text centered, and to make some gaps from the background from beginning and the end. I want a dynamic background so that it can set its width as the text size and give some more space at beginning and at end.

Can you please tell how to do this? Here is my HTML and CSS code:

.din{
    display: inline;
    border-radius: 15px 15px 15px 15px;
    background-color:#7c7779;
    text-align:center;
    color: #f8d8a9;
    width: 100px;
}

<ul class="date">
    <li class="din">
        মংলবার
    </li>
</ul>
David Thomas
  • 249,100
  • 51
  • 377
  • 410
wind
  • 338
  • 2
  • 11
  • I think
  • not accepting the width some how. You need make sure width applied to the
  • tag. stackoverflow.com/questions/2295311/… this may help you.
  • – Naren Nov 09 '15 at 11:21
  • The li does not accept the width because it's marked as inline. If you set display to inline-block instead, the width will be acknowledged. Inline elements cannot have a set width. – Andy Furniss Nov 09 '15 at 11:32