Color-adjust屬性已證明對打印文檔很有用。瀏覽器可以更改元素的顏色和外觀,以防止使用color-adjust屬性。
用法:
color-adjust:economy | exact
屬性值:
- economy:在這種情況下,瀏覽器可能會留下圖像,以便調整文本的顏色,使其更具可讀性。
用法:
color-adjust:economy
例:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width,
initial-scale=1.0">
<title>Document</title>
</head>
<style>
#box{
width:300px;
height:auto;
border-radius:50% 50%;
background-color:black;
background-image:linear-gradient(
rgba(17, 199, 0, 0.5), rgb(255, 255, 255));
color:rgb(0, 0, 0);
text-align:center;
font:24px "Helvetica", sans-serif;
display:grid;
justify-content:center;
color-adjust:economy;
}
</style>
<body>
<h1>color-adjust:economy</h1>
<div id="box">
<p>Geeks for Geeks</p>
</div>
</body>
</html>
輸出:
- exact:在這種情況下,未經用戶請求,不得更改頁麵的外觀。
用法:
color-adjust:exact
例:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width,
initial-scale=1.0">
<title>Document</title>
</head>
<style>
#box{
width:300px;
height:auto;
border-radius:50% 50%;
background-color:black;
background-image:linear-gradient(
rgba(17, 199, 0, 0.5), rgb(255, 255, 255));
color:#fff;
text-align:center;
font:24px "Helvetica", sans-serif;
display:grid;
justify-content:center;
color-adjust:exact;
}
</style>
<body>
<h1>color-adjust:exact</h1>
<div id="box">
<p>Geeks for Geeks</p>
</div>
</body>
</html>
輸出:
支持的瀏覽器:
- Firefox
- Opera
- 火狐瀏覽器
- Safari
- Edge
相關用法
- CSS transition-property用法及代碼示例
- CSS table-layout用法及代碼示例
- CSS text-align用法及代碼示例
- CSS border-top-width用法及代碼示例
- CSS isolation屬性用法及代碼示例
- CSS border-inline-start-style屬性用法及代碼示例
- CSS column-rule-width用法及代碼示例
- CSS word-spacing用法及代碼示例
- CSS animation-delay用法及代碼示例
- CSS margin-top用法及代碼示例
- CSS grid屬性用法及代碼示例
- CSS font-size-adjust用法及代碼示例
- CSS visibility屬性用法及代碼示例
- CSS grid-template-columns用法及代碼示例
- CSS height屬性用法及代碼示例
- CSS transform-origin用法及代碼示例
- CSS animation-name用法及代碼示例
- CSS flex-wrap用法及代碼示例
- CSS align-content用法及代碼示例
- CSS page-break-before屬性用法及代碼示例
- CSS empty-cells用法及代碼示例
注:本文由純淨天空篩選整理自tarun007大神的英文原創作品 CSS color-adjust Property。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。