css - 边界半径随着溢出规则消失

标签 css layout ionic-framework

我在使用 overflow:visible; 时遇到问题Ionic Framework avatar 规则 ion-item .我想创建一个聊天气泡,旁边有用户图像。我已经成功地让图像从其父级溢出,但结果是我在 ion-item 上设置的边界半径消失。没有边框半径,边框显示正确。

这就是我得到的。
Here's what I'm getting

以及我希望实现的目标。

The expected result

这是我的 CSS

.item-content,.item, p  {
     overflow: visible;

}

.item-avatar {
    margin-left:15%;
    max-width: 50%;
    border-radius: 10px;
    margin-top:10px; 

}

 .item-avatar .item-content > img:first-child,   .item-avatar-left {
    left:-50px;
     overflow: hidden;

}

这是我的 View 模板..
<ion-view view-title="Chats">
  <ion-content>
    <ion-list>
      <ion-item class="item-remove-animate item-avatar item-icon-right" ng-repeat="chat in chats" type="item-text-wrap" href="#/tab/chats/{{chat.id}}">
        <img class = "avatar" ng-src="{{chat.face}}">
        <h2>{{chat.name}}</h2>
        <p>{{chat.lastText}}</p>
         <p>{{chat.id}}</p>
        <i class="icon ion-chevron-right icon-accessory"></i>

        <ion-option-button class="button-assertive" ng-click="remove(chat)">
          Delete
        </ion-option-button>
      </ion-item>
    </ion-list>
  </ion-content>
</ion-view>

最佳答案

如果子元素有背景色并且设置为父元素的全宽和全高,那么边 Angular 会被剪掉。

最有可能的是,您的子元素不需要背景颜色,因此删除它可以解决您的问题。如果它确实需要背景颜色,则只需从父元素继承边框半径。

.item-avatar-child {
  border-radius: inherit;
}

关于css - 边界半径随着溢出规则消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39420256/

相关文章:

android - 在 android 的 Gallery 中添加 Relativelayout 或 listview?

android - 在 Ionic 2 中进行 HTTP POST 调用会给出禁止响应

html - Firefox 中不需要的小型大写字母的奇怪问题

html - 两列并排

html - CSS 自动换行不适用于 <a> 标签

jquery - 拖放后保持三行布局的问题

cordova - 如何使用 Cordova 检索 Firebase "remote config"

json - 服务在 Controller 之后运行?返回未定义

css - 如何去掉antd中的默认padding

css - 如何在 CSS 中使内部 div 不透明度为 1?