css - RWD,只使用 CSS +“属性内容”可以写标签吗?
问题描述
我需要:
/* in window FULL */
.contentbreak{
content:'';
}
/* in window PHONE */
.contentbreak{
content:'<br />';
}
但也许我还需要 usedOTHERS 标签。
可以不使用 JavaScript 吗?
解决方案
你可以简单地使用
<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;
}
推荐阅读
- php - PrestaShop 1.7.4 覆盖管理模板
- java - java.lang.NoClassDefFoundError:无法初始化类 org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil$ClassLoaderHolder
- security - 带有新编解码器的桌面视频播放器
- angular - 尽管 Postman 成功,Angular6 HttpClient Post 方法不起作用?
- c# - 如何使用 C# 从 IoT 中心使用设备 ID 获取设备密钥?
- javascript - 通过在 chrome 扩展中单击它们来显示网站表格元素
- c# - Acumatica 基于合同的 API SalesOrder.Detail 在处理 I210 课程材料时返回 null
- genexus - 在 Genexus 中,Know in runtime 是 Android 还是 IOS
- node.js - 基于位置的结果
- react-native - 如何根据条件更改视图