这6个css隐藏内容的方法,用过没?

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_25838839/article/details/85113712

最近有个不同行的盆友问我,怎么把内容隐藏起来,我第一想到了用css的方法隐藏起来,我测试了以下这6中方法是可行,欢迎一起交流下,css的其他方法,我们最常用的应该是display:none就行了,其他5种方法好像有seo作弊的嫌疑,虽然能把内容隐藏起来,但我个人感觉正规网站不提倡使用。

用css隐藏内容的6个方法

1.常用的display:none方法

1

<p style="display:none;">文字看不见</p>

2.文本缩进负值方法

1

<p style="text-indent:-99999px;">文字看不见</p>

3.文字大小为0方法

1

<p style="font-size:0">文字看不见</p>

扫描二维码关注公众号,回复: 5780939 查看本文章

4.width和height为0+防止溢出方法

1

<p style="width:0;height:0;overflow:hidden;">文字看不见</p>

5.绝对定位负值方法

1

<p style="position: absolute;left:-6600px;top:-1000px;">文字看不见</p>

6.绝对定位+margin负值方法

1

<p style="position:absolute;margin-top:-9999px;margin-left:-9999px; ">文字看不见</p>

除注明外的文章,均为来源:汤久生博客(QQ:1917843637),转载请保留本文地址!
原文地址:http://tangjiusheng.com/divcss/144.html

猜你喜欢

转载自blog.csdn.net/qq_25838839/article/details/85113712