css zoom 属性

本文详细介绍了 CSS 中的 zoom 属性及其用法。包括 zoom 的基本语法、取值方式及如何影响页面元素的缩放比例。并通过实例展示了如何在 HTML 文档中应用 zoom 属性来调整元素大小。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

基本语法zoom : normal | number
语法取值normal :  默认值。使用对象的实际尺寸number :  百分数 | 无符号浮点实数。浮点实数值为1.0或百分数为100%时相当于此属性的 normal 值使用说明

设置或检索对象的缩放比例。设置或更改一个已被呈递的对象的此属性值将导致环绕对象的内容重新流动。虽然此属性不可继承,但是它会影响对象的所有子对

象( children )。这种影响很像 background 和 filter 属性导致的变化。此属性对于 currentStyle 对象而言是只读的。对于视 频对象而言是可读写的。对应的脚本特性

为 zoom 。代码示例
1 div {zoom : 0.75; }
2 .clsTeenyWeeny { zoom: 0.10 }

 

范例:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" c />
<title>无标题文档</title>
<style type="text/css">

a{ /* 统一设置所有样式 */

 font-family: Arial;

 font-size: .8em;

text-align:center;

margin:3px;

}

a:link, a:visited{ /* 超链接正常状态、被访问过的样式 */

 color:

#A62020;

 padding:4px 10px 4px 10px;

background-color: #ecd8db;

text-decoration: none;

border-top: 1px solid #EEEEEE; /* 边框实现阴影效果 */

 border-left: 1px solid #EEEEEE;

 border-bottom: 1px solid #717171;

border-right: 1px solid #717171;

}
a:hover{ /* 鼠标经过时的超链接 */

color:#821818; /* 改变文字颜色 */

 padding:5px 8px 3px 12px; /* 改变文字位置 */

 background-color:#e2c4c9; /* 改变背景色 */

border-top: 1px solid #717171; /* 边框变换,实现“按下去”的效果 */ border-left: 1px solid #717171;

border-bottom: 1px solid #EEEEEE;

border-right:1px solid #EEEEEE; }
</style>


</head>
<body>
<a href="#">首 页</a> <a href="#">课 件</a> <a href="#">教 案</a> <a href="#">试 卷</a> <a href="#">图 库</a> <a href="#">视 频

</a>
</body>
</html>
--------------------------------------------------------------------------------------------------------------------------------------------------
-++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
--------------------------------------------------------------------------------------------------------------------------------------------------
添加zoom后:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" c />
<title>无标题文档</title>
<style type="text/css">
a { /* 统一设置所有样式 */
    font-family: Arial;
    font-size: .8em;
    text-align:center;
    margin:3px;
    zoom:1;
}
a:link, a:visited { /* 超链接正常状态、被访问过的样式 */
    color: #A62020;
    padding:4px 10px 4px 10px;
    background-color: #ecd8db;
    text-decoration: none;
    border-top: 1px solid #EEEEEE; /* 边框实现阴影效果 */
    border-left: 1px solid #EEEEEE;
    border-bottom: 1px solid #717171;
    border-right: 1px solid #717171;
}
a:hover { /* 鼠标经过时的超链接 */
    color:#821818; /* 改变文字颜色 */
    padding:5px 8px 3px 12px; /* 改变文字位置 */
    background-color:#e2c4c9; /* 改变背景色 */
    border-top: 1px solid #717171; /* 边框变换,实现“按下去”的效果 */
    border-left: 1px solid #717171;
    border-bottom: 1px solid #EEEEEE;
    border-right: 1px solid #EEEEEE;
}
</style>
</head>
<body>
<a href="#">首 页</a> <a href="#">课 件</a> <a href="#">教 案</a> <a href="#">试 卷</a> <a href="#">图 库</a> <a href="#">视 频

</a>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值