首页 > 解决方案 > RWD,只使用 CSS +“属性内容”可以写标签吗?

问题描述

它与仅使用 css 的换行符(如 <br>)完全不同

我需要:

/* in window FULL */
.contentbreak{
content:'';
}

/* in window PHONE */
.contentbreak{
content:'<br />';
}

但也许我还需要 usedOTHERS 标签。

可以不使用 JavaScript 吗?

标签: css

解决方案


你可以简单地使用

<br class="mobile">

具有相应的css样式:

@media screen and (min-width: XYZpx)  {
/*XYZ: your breakpoint; every value bigger than the one here would hide line break*/
        .mobile {
            display: none;
        }
    }

另一种可能性(纯 CSS):

@media screen and (min-width: XYZpx)  {
    #content::after{
    /* #content is the line before line break */
        content: "\a";
        white-space: pre;
    }

推荐阅读