简体   繁体   English

组件旁边添加了额外的像素(Airbnb 移动应用程序)?

[英]Extra pixels added next to components (Airbnb mobile app)?

I was looking at codes(via inspector mode)for the at the Airbnb mobile app version.我正在查看 Airbnb 移动应用程序版本的代码(通过检查员模式)。 Screenshot with extra pixel indicated in red marker As shown in the screenshot, there are extra pixels added to the image, image header("Online Experiences"), and description ("Unique activities... hosts.").带有红色标记的额外像素的屏幕截图 如屏幕截图所示,图像、图像标题(“在线体验”)和描述(“独特的活动...主机。”)中添加了额外的像素。 I'm not a coder, so maybe I'm not understanding it correctly.我不是编码员,所以也许我没有正确理解它。 From the development perspective, could someone explain why the blue block is defined in such manner?从开发的角度来看,有人可以解释为什么以这种方式定义蓝色块吗?

From UX/UI perspective, designers would usually define the padding(green blocks), but don't think these extra pixels (indicated in red marker) are defined by designers.从 UX/UI 的角度来看,设计师通常会定义填充(绿色块),但不要认为这些额外的像素(用红色标记表示)是由设计师定义的。

If you look at the margin of the blue box, then you can see, that it's centered and the margin on the right has the same size as on the left side.如果您查看蓝色框的边距,您会看到它居中,右侧的边距与左侧的大小相同。 So the responsiveness of that div box is correct.所以那个 div 框的响应是正确的。

The "extra pixels" part I think is because the picture can't fit your screen and the picture's attributes are set to keep it's xy side ratio, plus I think there is a min-height and a width: 100% attribute for that picture.我认为“额外像素”部分是因为图片不适合您的屏幕,并且图片的属性设置为保持 xy 边比,另外我认为该图片有min-heightwidth: 100%属性.

Ideally the picture can accomplish both min-height and width: 100% css rules, but since the width of the picture is relatively so big comparing to your screen's width, the browser can't accomplish the width: 100% rule and this is how you see the result.理想情况下,图片可以同时实现min-heightwidth: 100% css 规则,但是由于图片的宽度与屏幕宽度相比相对较大,浏览器无法实现width: 100%规则,这就是如何你看到了结果。

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

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