我有一个函数用来确定图像在特定矩形内的绝对最大尺寸(同时保持其纵横比)。我现在使用的代码肯定是错的,但我不确定哪里出错了。
// Sets the image to the largest proportional size possible
// based on the current browser window dimensions and original
// image size specified by the image loader
function applyLargestProportionalSize() {
var maxWidth = <width
有谁能告诉我们如何“提取”css中的景观图像,无论图像有多大的比例?图像不应该被缩放,而应该被裁剪。“新图像”应该包含输入图像的中心。
CSS:
.doesNotWork{
width:50%;
height:50%;
border: 1px solid rgb(34, 23, 187);
/* in my opinion this div should be a square too and display the same content as the other one but a bit bigger to be 50% of the width of th