只在电脑端显示手机端不显示,通过CSS代码控制DIV方法实现[WordPress教程]

热帖

有些时候我们需要自定义在WordPress网站的部分位置需要展示广告和特定的内容。但是我们希望这个位置的内容只在电脑端显示,但是在手机端是不显示的。那我们应该如何实现呢?其实我们只需要用CSS代码控制宽度就可以,超过某个宽带屏幕才可以显示,低于这个宽度就应该是在移动端就不给显示。

Sometimes we need to customize the display of advertisements and specific content in certain parts of the WordPress website. "However, we hope that the content of this location will only be displayed on the computer, but not on the phone.". So how should we achieve it? In fact, we only need to use CSS code to control the width, which can only be displayed if it exceeds a certain broadband screen. Below this width, it should not be displayed on the mobile terminal.
<div class="wp-none">电脑端显示的内容</div>

这个就是我们DIV控制的电脑端要显示的内容,用wp-none定义样式。

This is the content to be displayed on the computer side controlled by our DIV. Use wp-none to define the style.
@media screen and (max-width: 560px) { .wp-none{display:none; }}

我们在CSS中控制屏幕尺寸然后让其隐藏。是不是比较简单?

We control the screen size in CSS and then hide it. Is it simpler?
图片[1]-只在电脑端显示手机端不显示,通过CSS代码控制DIV方法实现[WordPress教程]-AA源码网 | 源码收藏
温馨提示:若内容/图片/下载链接失效,请在下方留言或登录后私信站长

本文结束END


© 版权声明
THE END
喜欢就支持一下吧
点赞1.5W+赞赏 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容