transformプロパティのscale()、scaleX()、scaleY()、scaleZ()、scale3d()は、要素を拡大、または、縮小表示する際に使用します。
p.sample1, p.sample2, p.sample3, p.sample4, p.sample5 {background-color:limegreen;}
p.sample1 img {transform: scale(0.5,0.5);}
p.sample2 img {transform: scaleX(0.5);}
p.sample3 img {transform: scaleY(0.5);}
p.sample4 img {transform: scaleZ(0.5);}
p.sample5 img {transform: scale3d(0.5,0.5,0.5);}
<html>
<head>
<link rel=”stylesheet” href=”sample.css”
type=”text/css”>
</head>
<body>
<p class=”sample1″>
scale(0.5,0.5)<br>
<img src=”https://www.htmq.com/wp-content/uploads/2024/07/kaeru.gif”>
</p>
<p class=”sample2″>
scaleX(0.5)<br>
<img src=”https://www.htmq.com/wp-content/uploads/2024/07/kaeru.gif”>
</p>
<p class=”sample3″>
scaleY(0.5)<br>
<img src=”https://www.htmq.com/wp-content/uploads/2024/07/kaeru.gif”>
</p>
<p class=”sample4″>
scaleZ(0.5)<br>
<img src=”https://www.htmq.com/wp-content/uploads/2024/07/kaeru.gif”>
</p>
<p class=”sample5″>
scale3d(0.5,0.5,0.5)<br>
<img src=”https://www.htmq.com/wp-content/uploads/2024/07/kaeru.gif”>
</p>
</body>
</html>
scale(0.5,0.5)
scaleX(0.5)
scaleY(0.5)
scaleZ(0.5)
scale3d(0.5,0.5,0.5)
p.prefix_sample1, p.prefix_sample2, p.prefix_sample3, p.prefix_sample4, p.prefix_sample5 {background-color:limegreen;}
p.prefix_sample1 img {
-moz-transform: scale(0.5,0.5);
-webkit-transform: scale(0.5,0.5);
-o-transform: scale(0.5,0.5);
-ms-transform: scale(0.5,0.5);
}
p.prefix_sample2 img {
-moz-transform: scaleX(0.5);
-webkit-transform: scaleX(0.5);
-o-transform: scaleX(0.5);
-ms-transform: scaleX(0.5);
}
p.prefix_sample3 img {
-moz-transform: scaleY(0.5);
-webkit-transform: scaleY(0.5);
-o-transform: scaleY(0.5);
-ms-transform: scaleY(0.5);
}
p.prefix_sample4 img {
-moz-transform: scaleZ(0.5);
-webkit-transform: scaleZ(0.5);
-o-transform: scaleZ(0.5);
-ms-transform: scaleZ(0.5);
}
p.prefix_sample5 img {
-moz-transform: scale3d(0.5,0.5,0.5);
-webkit-transform: scale3d(0.5,0.5,0.5);
-o-transform: scale3d(0.5,0.5,0.5);
-ms-transform: scale3d(0.5,0.5,0.5);
}
<html>
<head>
<link rel=”stylesheet” href=”sample.css” type=”text/css”>
</head>
<body>
<p class=”prefix_sample1″>
scale(0.5,0.5)<br>
<img src=”https://www.htmq.com/wp-content/uploads/2024/07/kaeru.gif”>
</p>
<p class=”prefix_sample2″>
scaleX(0.5)<br>
<img src=”https://www.htmq.com/wp-content/uploads/2024/07/kaeru.gif”>
</p>
<p class=”prefix_sample3″>
scaleY(0.5)<br>
<img src=”https://www.htmq.com/wp-content/uploads/2024/07/kaeru.gif”>
</p>
<p class=”prefix_sample4″>
scaleZ(0.5)<br>
<img src=”https://www.htmq.com/wp-content/uploads/2024/07/kaeru.gif”>
</p>
<p class=”prefix_sample5″>
scale3d(0.5,0.5,0.5)<br>
<img src=”https://www.htmq.com/wp-content/uploads/2024/07/kaeru.gif”>
</p>
</body>
</html>
scale(0.5,0.5)
scaleX(0.5)
scaleY(0.5)
scaleZ(0.5)
scale3d(0.5,0.5,0.5)