登录 | 注册 | FAQ
Anonymous

how to hide a <p> on a mobile site?

+ 发表回复

3 篇帖子 分页: 1 / 1


how to hide a <p> on a mobile site?

bananaxo » 周六 2月 13, 2016 9:59 pm

i created a css file that looks like this:
.hide {
display: none;
}

i have it linked at the top of my html file:
<link type="text/css" rel="stylesheet" media="only screen and (max-device-width:480px) and (orientation: landscape)" href="landscape.css"/>

used it in my html file: <p class= "hide">... </p>

what am i missing or doing wrong? :(
头像

bananaxo

  • 帖子: 1
  • 注册: 周六 2月 13, 2016 9:48 pm

Re: how to hide a <p> on a mobile site?

johnmacd » 周四 4月 14, 2016 1:03 pm

Try using <div>:

<div class="mobile-only" style="font-size: 0; max-height: 0; overflow: hidden; display: none">
<!--// Everything inside is invisible to desktop //-->
</div>
头像

johnmacd

  • 帖子: 23
  • 注册: 周四 6月 13, 2013 12:50 pm
--
Website Designer with 7 years experience as WordPress Developer. Affordable, Professional and Experienced. 100% Satisfaction. 24/7 Available.

Re: how to hide a <p> on a mobile site?

Farhin Qureshi » 周四 1月 12, 2017 12:21 pm

It works perfectly correct using the same code:
代码: 全选
<!DOCTYPE html>
<html>
   <head>
   <style>
   .hide {
display: none;
}
   </style>
   </head>
<body>
<p >hello </p>
</body>
</html>
.
头像

Farhin Qureshi

  • 帖子: 45
  • 注册: 周二 1月 03, 2017 11:33 am
--
Farhin Qureshi
.NET Developer
http://www.ifourtechnolab.com


+ 发表回复

分页: 1 / 1