代码之家  ›  专栏  ›  技术社区  ›  Faye D.

flex中的标签扰乱了盒子的布局

  •  0
  • Faye D.  · 技术社区  · 2 年前

    为什么会出现以下情况?超链接不能与其他文本内联显示吗?

    .test {
        padding: 25px;
        display: flex;
        height: 100%;
        text-align: center;
        font-size: 25px;
        font-weight: 600;
        line-height: 1.2;
        opacity: 0.7;
        align-items: center;
    }
    <div class="test">No results found. Looks like you may need some expert advice from our Customer Care team! Please <a href="https://ggogle.com">contact us</a> or check your selections.</div>
    1 回复  |  直到 2 年前
        1
  •  1
  •   mmirbekian    2 年前

    只需用“p”标记将文本包装即可。因为没有它就像光秃秃的。它可能会分崩离析。

    <!DOCTYPE html>
    <html>
    
    <head>
      <title>Page Title</title>
    </head>
    <style>
      .test {
        padding: 25px;
        display: flex;
        height: 100%;
        text-align: center;
        font-size: 25px;
        font-weight: 600;
        line-height: 1.2;
        opacity: 0.7;
        align-items: center;
      }
    </style>
    
    <body>
    
      <div class="test">
        <p>No results found. Looks like you may need some expert advice from our Customer Care team! Please <a href="https://ggogle.com">contact us</a> or check your selections.</p>
      </div>
    
    </body>
    
    </html>