CSS3中的变形处理

在css3中,可以利用transform功能来实现文字或者图像的旋转、缩放、倾斜、移动这四种类型的变形处理。

  • 旋转

旋转功能使用rotate方法参数中加入角度值,方向为顺时针旋转。示例清单如下:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>rotate使用实例</title>
<style>
div{
width:200px;
margin:200px auto;
background-color:red;
text-align:center;
-webkit-transform:rotate(45deg);
-moz-transform:rotate(45deg);
-o-transform:rotate(45deg);
}
</style>
</head>
<body>
<div>示例文字</div>
</body>
</html>

效果图:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPsAAACWCAIAAACXeml1AAACs0lEQVR4nO3b24riQBRA0fr/n+55GrA15mKccsxei0MjuRRBdmJeevxAyfj0BcBUiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF03K8+DGMef/MovhXZry6d/3E88d/8cyi+G2Lp6wv+PLe88d/68yi+Fdm/P27eGOcvB92+viX8OaZRfGHZyXu8XvjIYsL7rmGi8wsij88+4t/dtj66Ycu4Dozi+KPzXgo/vYhfbL4xWUffweuObOkiz/k9pTbFW4/PCt+ceOhgi+e+1D852alrbugH9P/R8VfP/eh+M/NZl6Lz/vN4u+2y/1+ZlH8+Hne4vrT+rHy9eI3Dzjk41/am2cWxY+f1cqfvY0snrJZ/Obe88d/68yi+L2J7zng5DN+z+VddmapF7/Z9+PGo3fInkUOXeE1Z5Z08ZtxL27cDHfnxp0pK/690sXfzc5XjvHwYX2FsfrUf+8r0BfPLIr/NXvyWg/x7hdg54J7Vrv4zKJ483/MLP7rjxbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhR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chBPcEX5EQ3BV8dUJwK/hKheB68FULwU7wFQzBVfDVDMFmBl/hVhT8/LmoYPgql71g+IqXt2D46pexYPgm0d1dnoLhm0pZCoZvQuUnGL5plZlg+CZXToLhm2LZCIZvouUhGL7ploFg+CbduoK/fQt9Pc3gm3pJC4ZvBqUrGL55lKhg+GbT9+92e7uO4Pfv7e/f0NdjBt+8WmUMfvvW/vwJfSVPwTezFgqOya7BN8dmC47MrsE302YIjs+uwTffJgmO0q7BN+s8Bcdq1+Cbe6OCI7Zr8KUhwXHbNfiSWY/g6O0afOmphmAFuwZf+t9FsIhdgy/VuruzDx9U7Bp8qdnpFPoMJgRfEg6+JBx8STj4knDwJeHgS8LBl4SDLwkHXxIOviQcfEk4+JJw8CXh4EvCwZeEgy8JB18SDr4kHHxJOPiScPAl4eBLwsGXhIMvCQdfEg6+JBx8STj4knDwJeHgS8LBl4SDLwkHXxIOviQcfEk4+JJw8CXh4EvCwZeEgy8JB18SDr4kHHxJOPiScPAl4eBLwsGXhIMvCQdfEg6+JBx8STj4knDwJeHgS8LBl4SDLwkHXxIOviQcfEm4fyChBM7QrzsEAAAAAElFTkSuQmCC" alt="" />

  • 缩放

使用scale方法来实现文字或图像的缩放处理,参数为水平缩小度数和垂直放大倍数。示例清单如下:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>scale使用实例</title>
<style>
div{
width:200px;
margin:200px auto;
background-color:red;
text-align:center;
-webkit-transform:scale(0.5,2);
-moz-transform:scale(0.5,2);
-o-transform:scale(0.5,2);
}
</style>
</head>
<body>
<div>示例文字</div>
</body>
</html>
效果图:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPsAAACWCAIAAACXeml1AAACs0lEQVR4nO3b24riQBRA0fr/n+55GrA15mKccsxei0MjuRRBdmJeevxAyfj0BcBUiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhb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TZZq8ewSg46kyTd49AtDxVJkm7x5BKfPfPzXffpW9flemyTs1OjWPh+2nxutn3jzNXn8n0+Sden1dl3f/T3uNl2nyqJM9l4321byWN9lrSpkmjz/rh47HNeLhg17nw4OrCwZ7/ZZMkyfodSplavq7CnRc69wZvvST2OuVTJP37nVak63tnr7QT2uXu9V0dn39vUyTJ+h1WRtte71aRD/cPbDXL8o0ee9e66v8su6q1iJPrxB2r/6hu7BPlWnyfqXWlfW9ps7Nx9rifOh13H4H19cAmSbv1+t7C3YoZS5lWF/0522Rx17fX1iF7mo9VabJQ870fLgefVuaRusuwW4FPfZaj7idAXvNIviUH+Ibmi2tY6+n6+vVt7LXH8k0ee9ex+0W7Ofra4dbXp4q0+SB5/u4WM7Nmjqe9Xqzvvp+bJhMkwee73YToO11ul1fr94RiL54tdcUAs93vT2g7W9a97NO19fdW7W7+qPDfapMkwf2Oq4f2yXzfn0dt72e7jO8vvcT2uupTJP36HVpopyai9Tj/QPT9fLp9WuYTJN36rVWeN/rfL182muYTJNHnex5uzlVf+uqlwHTWa+L62sCmSaPOtn1grXe4DJtez29W8D1NYNMk0ed7HH7YG7C3e1Y7X7fGv63P2Cvv5Zp8qiTvVtfl497vbqD217DZJo8R6+ndwzW/y9nS6y9hsk0eWCs09liebO+tg+KvfaTafLYU/4667VdUMtZr8v2fYHd0+z11zJNHnvKd2/GLocVd9xue1194WivgTJNHnvKjzcDHP/e9eavZNunhf4ljL1mEX/WucdTZZq8ewSg46kyTd49AtDxVJkm7x4B6Hiq504uInsVib2KxF5FYq8isVeR2KtI7FUk9ioSexWJvYrEXkViryKxV5HYq0jsVST2KhJ7FYm9isReRWKvIrFXkdirSOxVJPYqEnsVib2KxF5FYq8isVeR2KtI7FUk9ioSexWJvYrEXkViryKxV5HYq0jsVST2KhJ7FYm9isReRWKvIrFXkdirSOxVJPYqEnsVib2KxF5FYq8isVeR2KtI/gEMbrUcJSRGnAAAAABJRU5ErkJggg==" alt="" />

  • 倾斜

使用skew实现倾斜效果,参数为水平和垂直倾斜30度。示例清单如下:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>scale使用实例</title>
<style>
div{
width:200px;
margin:200px auto;
background-color:red;
text-align:center;
-webkit-transform:skew(30deg,30deg);
-moz-transform:skew(30deg,30deg);
-o-transform:skew(30deg,30deg);
}
</style>
</head>
<body>
<div>示例文字</div>
</body>
</html>
效果图:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPsAAACWCAIAAACXeml1AAACs0lEQVR4nO3b24riQBRA0fr/n+55GrA15mKccsxei0MjuRRBdmJeevxAyfj0BcBUiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF03K8+DGMef/MovhXZry6d/3E88d/8cyi+G2Lp6wv+PLe88d/68yi+Fdm/P27eGOcvB92+viX8OaZRfGHZyXu8XvjIYsL7rmGi8wsij88+4t/dtj66Ycu4Dozi+KPzXgo/vYhfbL4xWUffweuObOkiz/k9pTbFW4/PCt+ceOhgi+e+1D852alrbugH9P/R8VfP/eh+M/NZl6Lz/vN4u+2y/1+ZlH8+Hne4vrT+rHy9eI3Dzjk41/am2cWxY+f1cqfvY0snrJZ/Obe88d/68yi+L2J7zng5DN+z+VddmapF7/Z9+PGo3fInkUOXeE1Z5Z08ZtxL27cDHfnxp0pK/690sXfzc5XjvHwYX2FsfrUf+8r0BfPLIr/NXvyWg/x7hdg54J7Vrv4zKJ483/MLP7rjxbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF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iJHCQ1j797yUXw1HK2tOnrU9RoiRAmNxI7iu+eegDHYUXwXLrheRiQoofHYUXyjRwfsoU5H8VFCozp+vOIe72qPJUu0a5frNYSJEhrb9u0VR/FVddTXKD5KaHj9jOKr9rCj+NK/x5sSIMkbxef7ceu1HekfxUcJ8Dl0SK2twe+0Ll+e3lF8lIAyxaP4ajtSO4qPElBJ8Si+mo+JE1M3io8S0D/fKL4gx5w5yuVcr6FalIDB+EbxBTlaW3XkiOs1DI4SUJ3ubs2YETAGu8c72aP4KAFVs6P4xo0L2IMdxZfUPd6UgBqdODGkbRqLF2vnTtdrqIASEEjZKL4ajkSO4qMEBOUbxRfksKP4Ll92vYw+lIChsaP4Ro0K2ENiRvFRAsLgjeILeDzzjL7+2u0KKAHh2bpV8+YFjMGO4jt1ytW5UwJC1dOjDRuCT9OYNElvv+3kxCkBERjiKL5t2+I/ZUpAZA4eDDiKb/78+B/AUQIiFmwUX2dnzKdJCYhegFF8kyfr/Pk4z5ESEBc7iq/6Pd6vvBLn2VEC4rVvn5Ytq6qE5mYdPBjbeVECYlf9KL41a2I7KUqAI1WO4ovrU2+UAKcGHcU3Z46uXInhRCgBCbB9uxYs6DeGN96I4RQoAclgR/FNmVKhhAkTYhgbQwlIkosX1dFRYRTfSy9F/Z0pAclz+HDpKL7hw6P+CeqUgKQqGcW3bFmkH+ihBCSY3aYxYUJfDO++G923ogQk3tmzfaP4ZsyIbjw9JSAl9u/XqlV67bWI/npKQHr09mrTpogetFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYFECIFECYP0P6ZNZnINg7XwAAAAASUVORK5CYII=" alt="" />

  • 移动

使用translate,参数为水平向上和垂直向上移动50px。示例清单如下:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>scale使用实例</title>
<style>
div{
width:200px;
margin:200px auto;
background-color:red;
text-align:center;
-webkit-transform:translate(50px,50px);
-moz-transform:translate(50px,50px);
-o-transform:translate(50px,50px);
}
</style>
</head>
<body>
  <div>示例文字</div>
</body>
</html>
效果图:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPsAAACWCAIAAACXeml1AAACs0lEQVR4nO3b24riQBRA0fr/n+55GrA15mKccsxei0MjuRRBdmJeevxAyfj0BcBUiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF03K8+DGMef/MovhXZry6d/3E88d/8cyi+G2Lp6wv+PLe88d/68yi+Fdm/P27eGOcvB92+viX8OaZRfGHZyXu8XvjIYsL7rmGi8wsij88+4t/dtj66Ycu4Dozi+KPzXgo/vYhfbL4xWUffweuObOkiz/k9pTbFW4/PCt+ceOhgi+e+1D852alrbugH9P/R8VfP/eh+M/NZl6Lz/vN4u+2y/1+ZlH8+Hne4vrT+rHy9eI3Dzjk41/am2cWxY+f1cqfvY0snrJZ/Obe88d/68yi+L2J7zng5DN+z+VddmapF7/Z9+PGo3fInkUOXeE1Z5Z08ZtxL27cDHfnxp0pK/690sXfzc5XjvHwYX2FsfrUf+8r0BfPLIr/NXvyWg/x7hdg54J7Vrv4zKJ483/MLP7rjxbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRPi+JpUTwtiqdF8bQonhbF06J4WhRP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AASUVORK5CYII=" alt="" />

  • 对一个元素使用多种变形。示例清单如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>scale使用实例</title>
<style>
div{
width:200px;
margin:200px auto;
background-color:red;
text-align:center;
-webkit-transform:translate(150px,200px) rotate(45deg) scale(1.5);
-moz-transform:translate(150px,200px) rotate(45deg) scale(1.5);
-o-transform:translate(150px,200px) rotate(45deg) scale(1.5);
}
</style>
</head>
<body>
  <div>示例文字</div>
</body>
</html>
效果图:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMsAAACWCAIAAAD/ietNAAAGIElEQVR4nO3aXYhUdRiA8cfAKLo6G5RaF8JWYLdBFF1FRJRBEmmRuahFVJpjFhQpFaJF0aeVRhmmFVESVCQVgUJpHxfe9EVBBGXNrq67a+7H7OzOerqQI2eYmXVZfDvu8vx4L4b/nD0ze3g45+zMkkqRKPoNaJqzMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWyMMWaWGFjY2lfX9rb60znGRgorrByOZ09O21rm04z0NY22mJ9pGFxsK1taGL7HC7695r83HFHcYUdOJDOmJHC6T+D0NViBuu3XAz7m+3hHviiYXEHrIPqyV59GzwDx4o+CJOc+fOLK+zvv9Ozzir+EExgtkJ7i9lav+X18BUchsPQBYey9dvgk4bdjsJK2NnsFYehO4v4d7gZtteXfaToYzLRWbDAwk4+A1BuMQO5zYZgCXwMl8JsaIfLoQ+GoAN2QS3r4zAchG7ogOeyFvNRvgazsogvgfPgglzWl8BlMFb0YbGw/3vWwRYYhk3QAT3QC5/AOijBHvgjS+R8mAvtMAsuhHa4MIvySqjAWlgPh6EHeuBf6IMe6IYyfAfXNlygT9OxsFM1VbgLtkEK78Py7Oy1E0qwGnbBaHbmuwr2QiccgoPQBS/C7VCGg7ALSjA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TdeGFgZK9807l5LhecmoWa0T4/ns9+migXlu21MiRKi52vaQmFmsEmT5dl10WKNmuXZWZ6XrGSVmskWX3bvXvH6jX2FgNGqS9e10vOQGLNRItWKCrrgqUbKdOyshwPeNYFmuEOnBAw4apRYtAyT75pHbudL3kCIs1oi1bpptuCtTrJZcoNdX1jN9ZrJGutFSvvaZWrQIl26OHNm1yvcRijRJffaX77gvU63nnadw4VVQ4HGGxRo3Q7YOEhEDJ3nWXvvzS1QKLNcps3qykpEC9xsdr1CiVlDT9tVusUWnaNLVvHyjZbt2Und3EV22xRqv8fPXrF6jXuDgNGaJ9+5rski3W6DZvnhITAyXbpYvmzm2ai7VYo15hoYYOVVxcoGT79lVeXmNfqcVqJEnZ2brxxkC9tmuntLRGvUaL1YSVlGj0aMXHB0o2KUnffttIF2ixmqOtWaN77gnU6/nna+LExrh9YLGa41RUaNIktW4dKNlu3Rr8JdZiNSfx7bfq2bOepcbE6OmnlZ/fsFdksZoaffCBLr20bqVef72yshrjWixWcyp5eerTp1aZhu7EFhU10oVYrKZ2MjLUuXNNpd5xR2M/42Kxmlrbt0+DBys29gT//B83rgl++IDFauooM1M33HCk1B49lJvbNH+zxWrqrrhYyclKTNTUqU3511qspr6a/CdiWKzGGxar8YbFarxhsRpvWKzGGxar8YbFarxhsRpvWKzGGxar8YbFarxhsRpvWKzGGxar8YbFarxhsRpvWKzGGxar8YbFarxhsRpvWKzGG/8H2hR5mPGvfl0AAAAASUVORK5CYII=" alt="" />

说明:第一张图为未变形前,后一张为变形后。

上一篇:Spring Cloud Config 配置中心 自动加解密功能 jasypt方式


下一篇:多个div并排显示的居中问题——来自腾讯的一道面试题