Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> CSS

Thuộc tính word-wrap trong CSS

Giới thiệu

Thuộc tính word-wrap được dùng để ngắt dòng và-wrap sang dòng tiếp theo khi từ quá dài.

Ví dụ

<!DOCTYPE html>
<html>
<head>
    <style>
        div {
            width: 200px;
            border: 2px solid #000000;
        }
        div.b {
            word-wrap: break-word;
        }
    </style>
</head>
<body>
    <h2>Thuộc tính word-wrap: break-word</h2>
    <div class="b"> ThisisdemotextThisisdemotext: thisisaveryveryveryveryveryverylongword. Từ dài sẽ-wrap sang dòng tiếp theo.</div>
</body>
</html>

Kết quả

Thuộc tính word-wrap trong CSS