use the css transform scale property to change the size of an element - zilongxuan001/LearnFreecode GitHub Wiki
为改变元素的比例,CSS有transform
属性和scale()
功能。
下面例子是将原来<p>
元素的尺寸在页面中放大两倍。
p {
transform:scale(2);
}
将id为ball2
的元素的尺寸调整为1.5倍。
<style>
.ball {
width: 40px;
height: 40px;
margin: 50 auto;
position: fixed;
background: linear-gradient(
35deg,
#ccffff,
#ffcccc
);
border-radius: 50%;
}
#ball1 {
left: 20%;
}
#ball2 {
left: 65%;
transform:scale(1.5);
}
</style>
<div class="ball" id= "ball1"></div>
<div class="ball" id= "ball2"></div>
2018-10-30 15:03:46