Kyle
Kyle

Reputation: 1578

How can I break decimal numbers like words in HTML?

I would like to break numbers with dots and commas just like I break up words. How can I do it?

Thanks in advance

"live long and prosper"

div {
  border: 1px solid red;
  max-width: 50px;
  word-break: break-all;
}
<!DOCTYPE html>
<html>

<head>
  <title>HTML5, CSS3 and JavaScript demo</title>
</head>

<body>
  <div>3.0.0.1.2.3.1.2.3</div>
  <div>Beam me up scotty!</div>
</body>

</html>

Upvotes: 1

Views: 444

Answers (1)

Amin Jafari
Amin Jafari

Reputation: 7207

you need to use word-wrap:break-word: DEMO

div {
  border: 1px solid red;
  max-width: 50px;
  word-break: break-all;
  word-wrap: break-word;
}

Upvotes: 5

Related Questions