试图在移动设备上隐藏元素

时间:2014-10-24 18:24:43

标签: css wordpress hide element

在我的Wordpress网站上,我有一个比特币小费小部件,我想隐藏在手持移动设备上。

这是插件中的当前CSS:

.bitcointips-widget {
  background-color: #fff;
  color: #191919;
  position: relative;
  border: 1px solid silver;
  margin: 16px 0;
  padding: 16px;
}

.bitcointips-widget * {
  clear: none;
}

.bitcointips-widget:after {
    content: ".";
    display: block;
    clear: both;
    visibility: hidden;
    line-height: 0;
    height: 0;
}

.bitcointips-widget .qrcode {
  clear: none;
  float: left;
  width: 125px;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}

.bitcointips-widget .contents {
  clear: none;
  margin-left: 136px;
}

.bitcointips-widget .contents h2 {
  margin: -2px 0 8px;
  font-size: 24px;
  line-height: 28px;
}

.bitcointips-widget .contents p {
  margin: 8px 0;
}

.bitcointips-widget .pluginhome {
  position: absolute;
  bottom: 0;
  right: 4px;
  font-size: 10px;
  text-align: center;
}

.bitcointips-widget .pluginhome a, .bitcointips-widget .pluginhome a:visited {
  color: silver;
}


.bitcointips-widget .pluginhome a:hover {
  color: inherit;
}

这就是页面源代码中的内容:

<div class="bitcointips-widget"><div class="qrcode"><a href="bitcoin:19yvKvsuc5jv46NS6Hk8se4B9Lz7QVqSoD"><img src="http://altcoinpress.com/wp-content/uploads/2014/10/newbitcoinaddress_125.png" width="125" height="125" /></a></div><div class="contents"><h2>Like this post? Tip me with Bitcoin!</h2><p><a href="bitcoin:19yvKvsuc5jv46NS6Hk8se4B9Lz7QVqSoD">19yvKvsuc5jv46NS6Hk8se4B9Lz7QVqSoD</a></p><p>If you enjoyed reading this article, please consider tipping me using Bitcoin. All donations go towards supporting this website and its writers. Your generosity is very much appreciated.</p></div><div class="pluginhome"><a href="https://bitcoin.org/">Get a Bitcoin Wallet</a></div></div>

如果有人可以帮我解决这个问题,我们将不胜感激!

谢谢,格雷格。

1 个答案:

答案 0 :(得分:1)

使用CSS媒体查询:

@media all and (max-width: 640px) {
  .bitcointips-widget {
    display: none;
  }
}