在下面的例子中,我希望根据设备只显示一个
标签。 我知道如何使用@media来覆盖CSS类,但不知道如何进行条件判断。
<style type="text/css">
@media (max-width : 770px) {
...
}
@media (max-width : 320px) {
...
}
//do I need another for the desktop?
</style>
//if desktop
<div style="width: 400px; float: left;">
this is desktop
<a href="somepage.html"><img src="aLargeImage.png"/></a>
</div>
//if mobile
<div style="width: 200px; float: left;">
this is mobile
<a href="somepage.html">just text</a>
</div>
有什么建议吗?