【发布时间】:2016-01-11 22:26:03
【问题描述】:
我在使用 link_to 和 image_tag 方法和 CSS 时遇到了严重问题。无论出于何种原因,我都无法使用我编写的 CSS 来保持我的头像的圆形形状。当我只使用 image_tag 时,它工作得很好。当我同时使用 link_to 和 image_tag 时,它会将图像变回正方形。
这是链接
<%= link_to(image_tag(current_user.avatar_url(:thumb)), current_user, class: 'round-image-50', title: "Profile", style: '') %>
.round-image-50 {
background-color: white;
border: 1px solid #d9d9d9;
border-radius: 25px;
-moz-border-radius: 25px;
-webkit-border-radius: 25px;
height: 50px;
width: 50px;
overflow: hidden;
text-align: center;
img {
width: 100%
}
}
你能帮我弄清楚为什么它会覆盖为它编写的 CSS 属性吗?
【问题讨论】:
标签: html css ruby-on-rails ruby-on-rails-4