HTML
CSS
PHP
Deno
Examples
Do It Yourself
Blog
Type in your code below
Run
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"/> <meta content="IE=edge" http-equiv="X-UA-Compatible"/> <meta content="width=device-width, initial-scale=1.0" name="viewport"/> <title>CSS conditional rules, content negotiation, @supports example.</title> </head> <style> .topic { font-family: Arial, Helvetica, sans-serif; font-size: 32px; width: 200px; border: dashed 3px #000; border-radius: 10px; background-color: hotpink; color: #000; overflow: hidden; } .topic::before { display: inline-block; color: green; font-size: 16px; } @supports (-webkit-line-clamp: 3) and (display: -webkit-box) and (-webkit-box-orient: vertical) { .topic { -webkit-line-clamp: 3; display: -webkit-box; -webkit-box-orient: vertical; } } @supports not (-webkit-line-clamp: 3) or not (display: -webkit-box) or not (-webkit-box-orient: vertical) { @supports (text-overflow: ellipsis) { .topic { text-overflow: ellipsis; white-space: nowrap; } .topic::before { content: "Your browser does not supports webkit-line-clamp: 3 but support text-overflow: ellipsis."; } } @supports not (text-overflow: ellipsis) { .topic { display: block; height: 100px; } .topic::before { content: "Your browser does not supports webkit-line-clamp: 3 and text-overflow: ellipsis."; } } } </style> <body> <h2 class="topic"> Testing out the CSS conditional rules with the @supports features. </h2> </body> </html>