If you intend to use LESS CSS you can try out this :
@percent: 1;
@height: `Math.round( screen.height * @{percent})`;
@width: `Math.round( screen.width * @{percent})`;
div.content {
margin: auto;
top: @height;
width: @width;
}
If you intend to use JQUERY you can try out this :
var percent=1;
$("div.content").css('top', Math.round( screen.height * percent)+'px');
$("div.content").width(Math.round( screen.width * percent));
If you intend to use JS you can try out this :
var percent=1;
document.querySelector('div.content').style.top = Math.round( screen.height * percent)+'px';
document.querySelector('div.content').style.width = Math.round( screen.width * percent)+'px';
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…