Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make text in paraghapghs in div overflow instead of new lines

Say I have several pretty longs lines in a paragraph:

<div style="overflow: auto"> 
    <p> 
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccc
    </p> 
    <p> 
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccc
    </p> 
</div>

and window width less that width of the pahagraph (a's + b's + c's). Currently scroll will appear only if width of any of components (a, b, or c) is more that width of the window and over components are carried to the new lines. I want contents of each paragraph appear on the same line with a scroll. How can I treat each paraghaph as a string, so contents of the paragraph is treated like a single line?

like image 241
Sergei G Avatar asked Dec 09 '22 16:12

Sergei G


1 Answers

With CSS you can do:

p {
    white-space: nowrap;
    overflow: auto
}

This make the spaces non-breaking, so the paragraph will all be on one line.

like image 162
Piet van Dongen Avatar answered Dec 11 '22 05:12

Piet van Dongen