简体   繁体   English

图像被裁剪

[英]Image getting cropped of

I have an image that gets cropped when I set the background size to cover but it is not wide enough if i change the background size to contain.当我将背景大小设置为覆盖时,我有一个图像被裁剪,但如果我将背景大小更改为包含,它就不够宽。 I have specific width and height I just can't seem to find a solution for it to not get cropped.我有特定的宽度和高度,我似乎无法找到不被裁剪的解决方案。

.hard-case-container {
background-image: url(/images/HARDCASE.png);
height: 536px;
width: 648px;
border-radius: 25px;
background-size: cover;
display: flex;
flex-direction: column;
justify-content: space-around;

Firstly, you're missing a closing bracket in your CSS.首先,您在 CSS 中缺少右括号。

Secondly, if you have a landscape image you want to fit in your potrait screen, then this will not work.其次,如果您有一张横向图像要适合您的肖像屏幕,那么这将不起作用。 Same goes for the other way around.反过来也一样。

You will always have to find a compromise - either cut some part of the image or let some part of the image be white (or another background color set).您将始终需要找到折衷方案 - 要么剪切图像的某些部分,要么让图像的某些部分变为白色(或设置其他背景颜色)。

If you force your image to fit the screen, it will look drawn out.如果你强迫你的图像适合屏幕,它看起来会被拉长。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM