resize属性可以设置是否允许用户缩放网页中元素的大小
总共有4种取值
none
vertical
horizontal
both
举个栗子
<!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" content="text/html; charset=utf-8" /> <title>resize</title> <style type="text/css"> #resize { background:url(images/img19.jpg) no-repeat center; -moz-background-clip:content; -webkit-background-clip:content; background-clip:content; width:200px; height:120px; max-width:800px; max-height:600px; padding:6px; border: 1px solid red; resize: both; overflow: auto; } </style> </head> <body> <div id="resize"></div> </body> </html>
记得定义最大尺寸,把缩放控制在一定范围之内。
时间: 2024-12-27 03:10:05