How to Wrap Text in Css?

the text just overflows into a vertical direction.How to make it wrap? css for the div:

.taskdescription{
  display:block;
  word-wrap: break-word;
  overflow: auto;
  color: #673ab7;
  width: 300px;

} 

what its looking like.

6

2 Answers

Ok so I used white-space: no wrap which was overriding this properties.So changing it to white-space:normal solved my problem.Thank you

The overflow-wrap has attributes: normal, break-word, anywhere. When you change with word-wrap it will work.

The easy-squeeze example is on w3school-overflow-wrap You mismatched the overflow ( this is for scroll ) with word-wrap or overflow-wrap.

The first one is for text and the second is for long-word. This is a confused bunch of CSS properties because overflow is doing something else. Try to decode it in the w3school example - works the same as a fiddle.

word-wrap - example overflow - example scrolling-bar

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest