EN
CSS - how to disable line wrapping in HTML?
2 points
Using CSS it is possible to remove line wrapping in following ways.
Note: read this article how to disable world wrapping.
xxxxxxxxxx
1
2
<html>
3
<head>
4
<style>
5
6
p {
7
border: 1px solid black;
8
width: 200px;
9
white-space: nowrap;
10
}
11
12
</style>
13
</head>
14
<body>
15
<p>
16
Very long web page text here: 1 2 3 4 5 ...
17
Very long web page text here: 1 2 3 4 5 ...
18
</p>
19
</body>
20
</html>
Note: use
<br />
element to break lines.
This approach makes text behaving similar to pre
tag - white characters in source code are visible on web page.
xxxxxxxxxx
1
2
<html>
3
<head>
4
<style>
5
6
p {
7
border: 1px solid black;
8
width: 200px;
9
white-space: pre;
10
}
11
12
</style>
13
</head>
14
<body>
15
<p>Very long web page text here: 1 2 3 4 5 ...
16
Very long web page text here: 1 2 3 4 5 ...</p>
17
</body>
18
</html>