首页 > 解决方案 > 如何在移动视图中忽略 br 标签

问题描述

我有一些代码行,我
只需要在桌面视图中使用标签,但在移动视图中忽略它。代码是

     <p class="email-message">
        <spring:theme code="text.guestuserorder.status.email.confirmation" text="Your order number can be found in your confirmation email"/>   
        <c:if test="${resendEmailToggle eq 'true'}">
        <br><span role="link" tabindex="0" class="resend-confirmation-mail-link mobile-alignment"><spring:theme code="lost.your.confirmation.mail.text" text="Lost your confirmation mail?"/>
              <span class="sr-only">This action will open modal</span>
            </span>                           
        </c:if>
    </p>

标签: css

解决方案


将此添加到您的 CSS 中:

@media(max-width: 360px) {
  .email-message br {
    display: none;
  }
}

使用一些ID或类将其效果封装在您特别需要的元素中,否则它将摆脱br移动中的所有标签。如果这是您想要的,只需执行以下操作:

@media(max-width: 360px) {
  br {
    display: none;
  }
}

推荐阅读