Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordwrap within css div [closed]

I am having issues with wordwrapping within my div container. Here is the code for this specific section of code. I want it to automatically wrap to next line even if there are no spaces in the specified line of text.

#content {
    position: justify;
    font-size: 10px;
    font-family: Times new roman;
    width: 80%;
    padding: 10px 10px 10px 10px;
    height: auto;
    overflow-x: auto;
    color: #000;
}
like image 938
Q's Jester Avatar asked Jan 28 '26 02:01

Q's Jester


2 Answers

You need word-wrap:break-word.

jsFiddle example

#content {
    word-wrap: break-word;
    position:justify;
    font-size: 10px;
    font-family: Times new roman;
    width: 80%;
    padding: 10px 10px 10px 10px;
    height: auto;
    overflow-x: auto;
    color: #000;
}
like image 83
Josh Crozier Avatar answered Jan 29 '26 14:01

Josh Crozier


Add this to your CSS

word-wrap: break-word;
like image 40
Charlie74 Avatar answered Jan 29 '26 16:01

Charlie74



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!