我想在我的主頁的背景添加視頻。 基本上我想避免當瀏覽器分辨率與我的視頻分辨率不同時在邊上有黑色條紋。調整視頻的大小取決於屏幕尺寸少用CSS
要優化加載時間,我想用更少的CSS,所以我想在更短的像這樣來定義價值做到這一點:
@videoHeight: '1080';
@videoWidth: '2048';
@alphaVideo: '1,9';
@winHeight:'$(window).height()';
@winWidth:'$(window).width()';
@alphaWin: @winHeight/@winWidth;
@media only screen and (min-width: @alphaVideo * @winHeight) {
#video-background {
transform: scale(1.1);
-webkit-transform: scale(1.1);
-moz-transform: scale(1.1);
-o-transform: scale(1.1);
}
}
,但我得到了下面的錯誤在我的瀏覽器: OperationError:無效類型 在無效行0,列0上的操作:
1 @ videoWidth:'2048';
我該如何解決這個問題?
感謝
使用JS的替代方法:http://stackoverflow.com/questions/18090595/center-fullscreen-background-video/18091239#18091239 – gvee
可能重複的[創建div平方,並相應地居中使用視圖端口使用較少](http://stackoverflow.com/questions/17983241/create-a-div-square-and-center-it-accordingly-the-view-port-using-less) – cimmanon