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

Thuộc tính CSS hyphens


Thuộc tính hyphens dùng để chỉ định cách tách từ (hyphenate) khi văn bản ngắt dòng qua nhiều dòng. Các giá trị:

hyphens: none | manual | auto | initial | inherit;

Ví dụ

<!DOCTYPE html> <html> <head> <style> div {    width: 50px;    border: 2px dashed red; } .demo {    -webkit-hyphens: manual;    -ms-hyphens: manual;    hyphens: manual; } </style> </head> <body> <h1>Demo Heading</h1> <h2>hyphens: manual property value</h2> <div class="demo">This is a demo text.</div> </body> </html>

Kết quả

Thuộc tính CSS hyphens

Ví dụ khác

Xem thêm ví dụ dưới đây:

<!DOCTYPE html> <html> <head> <style> div {    width: 50px;    border: 2px dashed red;    color: blue; } .demo {    -webkit-hyphens: auto;    -ms-hyphens: auto;    hyphens: auto; } </style> </head> <body> <h1>Demo Heading</h1> <h2>hyphens: auto property value</h2> <div class="demo">This isssssss a demo text.</div> </body> </html>

Kết quả

Thuộc tính CSS hyphens