React Native - What is the point of using the overflow property for <img/> component?

时间:2018-12-03 12:50:14

标签: css reactjs css3 react-native

According to my knowledge overflow property is used to enable or disable the scrolling in CSS or in CSS type stylingsheet. Can anyone tell what is the point of using the overflow property for <Image/> component? A little example will be more appreciated. Thanks !!!

Reference link

2 个答案:

答案 0 :(得分:3)

The overflow property is used to define actions that will happen if the image goes out of bounds. Say you have a <div> with the width or height set to 100px. Inside the <div> you have an <Image> that is 200px, the image would show out of bounds. If we take overflow:hidden as an example, the image would be cut off at the bounds of the <div>

答案 1 :(得分:1)

由于<img>是一个空元素(内容:没有内容),因此在其上设置overflow确实毫无意义

但是,如果查看<Image/>组件的输出(页面源代码中实际呈现的内容),您会发现它不是<img>标记,而是<div>标记,“图像” 实际上显示为该background-image的{​​{1}}。因此,它可以包含内容。

相关问题