在移动设备或特定分辨率下添加 <br> 标签

Dny*_*yan 5 html javascript css jquery

我想为移动视图分辨率添加 br 标签,如 320px - 480px。我试过 margin top , bottom 但没有用。所以请帮助我。

我想在这两个锚标签之间添加 br 标签。下面两个这样的标签。

<a class="ww" href="counseller.html">Career Counsellor</a> 
<a class="xx" href="mentors.html"> Career Mentor</a>
Run Code Online (Sandbox Code Playgroud)

Tus*_*har 5

您可以使用媒体查询

该类mobile应用于<br />. 当width浏览器的小于320px时,将应用媒体查询中的类并显示元素。

.mobile {
  display: none;
}
@media (max-width: 320px) {
  .mobile {
    display: block;
    /* Add other properties here */
  }
}
Run Code Online (Sandbox Code Playgroud)
<a class="ww" href="counseller.html">Career Counsellor</a>
<br class="mobile" />
<a class="xx" href="mentors.html"> Career Mentor</a>
Run Code Online (Sandbox Code Playgroud)