How to make a span fixed-width with CSS?

Spread the love

Sometimes, we want to make a span fixed-width with CSS.

In this article, we’ll look at how to make a span fixed-width with CSS.

How to make a span fixed-width with CSS?

To make a span fixed-width with CSS, we can set the display property.

For instance, we write

span {
  display: inline-block;
  width: 50px;
}

to set the span’s display property to inline-block so we can set its width.

Then we set its width to 50px.

Conclusion

To make a span fixed-width with CSS, we can set the display property.

Leave a Reply

Your email address will not be published.