html - 避免言语分手

标签 html css ruby-on-rails

我的布局 (HTML/CSS) 有问题。我的话会中断到第二行,从而产生可怕的效果。

我已经在我的 CSS 中尝试了 word-break: break-word 但没有用。

我的再培训局

 <%= link_to tag_path(tag), class: "line-height" do %>
       <span class="spot_tag"> # <%= "#{tag}" %> </span>
 <% end %>

我的 CSS

     .spot_tag {
    margin-right: 5px;
    text-shadow: 1px 1px 0px #48b581;
    color: #ebfff5;
    border: 1px solid #34c17e;  
    font-weight: 700;
    text-rendering: optimizeLegibility;
    background-color: #29cf9a;
    padding: 5px 10px;
    border-radius: 35px;
    font-size: 13px;
    background: #4be59b; /* Old browsers */
}

问题

Prob with tags

最佳答案

将跨度显示为内联 block 。这样它就会粘在一起。

.spot_tag {
    margin-right: 5px;
    text-shadow: 1px 1px 0px #48b581;
    color: #ebfff5;
    border: 1px solid #34c17e;  
    font-weight: 700;
    text-rendering: optimizeLegibility;
    background-color: #29cf9a;
    padding: 5px 10px;
    border-radius: 35px;
    font-size: 13px;
    background: #4be59b; /* Old browsers */
    display: inline-block;
}

DEMO .

关于html - 避免言语分手,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25957878/

相关文章:

html - margin + height 使 child 即使使用 box-sizing :border-box 也会溢出

javascript - 如何将 widget webapp 框架与 SEO 友好的 CSS 和 JS 文件结合起来

html - 调试 div 和盒子模型

ruby-on-rails - counter_cache 列返回 0 的 Rspec 测试

javascript - 在 AngularJS 网页中滚动后如何修复元素

html - 停止官方 twitter 小部件逃出我的 div 边界

使用 SVG 中的外部对象创建文本区域的 Javascript 不起作用

html - 当背景图像显示为页面背景时,如何防止它被放大?

css - 包含网络字体时出现 SASS SyntaxError

ruby-on-rails - 可用 Rails http header 列表(如 ":success"、 ":created"和 ":bad_request")。它在哪里?