延伸閱讀:http://jingyan.baidu.com/article/9faa72317903f1473c28cb01.html
[……]
延伸閱讀:http://jingyan.baidu.com/article/9faa72317903f1473c28cb01.html
[……]
今天很其怪用transition scale來改變容器大小沒問題
但對圖片就沒有效,上網找了了解決方法
img{
/* Webkit for Chrome and Safari */
-webkit-transform: scale(1, 1); /* This is the scale for the normal size of the image.*/
-webkit-transition-duration: 500ms;
-webkit-transition-timing-function: ease-out;
/* Webkit for Mozila Firefox */
-moz-transform: scale(1, 1);
-moz-transition-duration: 500ms;
-moz-transition-timing-function: ease-out;
/* Webkit for IE( Version: 11, 10 ) */
-ms-transform: scale(1, 1);
-ms-transition-duration: 500ms;
-ms-transition-timing-function: ease-out;
}
img:hover{
/* Webkit for Chrome and Safari */
-webkit-transform: scale(1.2, 1.2); // This is the enlarged size scale of the image.
-webkit-transition-duration: 500ms;
-webkit-transition-timing-function: ease-out;
/* Webkit for Mozila Firefox */
-moz-transform: scale(1.2, 1.2);
-moz-transition-duration: 500ms;
-moz-transition-timing-function: ease-out;
/* Webkit for IE( Version: 11, 10 ) */
-ms-transform: scale(1.20, 1.20);
-ms-transition-duration: 500ms;
-ms-transition-timing-function: ease-out;
}
延伸閱讀:https://drujoopress.wordpress.com/2014/01/31/zoom-effect-using-css3-transition-scale/[……]
2020/03/12 更新發現更簡單的方法,請參考這篇文章https://vector.cool/css-ul-li-horizontal-align-center-only-css/
<div class="main-container"> <div class="fixer-container"> <ul class="list-of-floating-elements"> <li class="floated">Floated element</li> <li class="floated">Floated element</li> <li class="floated">Floated element</li> </ul> </div> </div>
CSS:
<style> ul li{ float:left; margin:0 20px } .main-container { float:left; position:relative; left:50%; } .fixer-container { float:left; position:relative; left:-50%; } </style>
[……]
[……]
/** * VECTOR * https://vector.cool */ <script> $('.classname').get(0).tagName; $('.classname')[0].tagName; $('.classname').prop("tagName"); </script>
[……]