我需要检查元素是否具有适用于移动设备(或在响应模式下)的样式的属性。例如:
await guyManager.ReadGuyAync();
浏览器:
<tr>
<td>Some text here</td>
<td data-content="Hello there">Other text here</td>
<td data-content="Hi there">Final text here</td>
</tr>
移动设备(必填输出):
------------------------------------------------------
| Some text here | Other text here | Final text here |
------------------------------------------------------
SCSS:
--------------------------------
| Some text here |
| Hello there: Other text here |
| Hi there: Final text here |
--------------------------------
移动设备(当前输出):
tr {
td {
...
@if (&[data-content]) {
&:before {
content: attr(data-content) ":";
float: left;
font-size: 12px;
font-weight: bold;
margin: 0 5px 0 0;
text-transform: uppercase;
}
}
}
}
答案 0 :(得分:0)
我找到了解决方案。显然,这很容易...
SCSS:
tr {
td {
...
&[data-content] {
&:before {
content: attr(data-content) ":";
float: left;
font-size: 12px;
font-weight: bold;
margin: 0 5px 0 0;
text-transform: uppercase;
}
}
}
}
当前输出:
--------------------------------
| Some text here |
| Hello there: Other text here |
| Hi there: Final text here |
--------------------------------