css用背景图来替换文字来达到隐藏文字的目的
根据html代码的不同来分成两大类方法,如下
html代码:
<h1 class="replace-indent">hello see</h1>
第一种方法:text-indent
.replace-indent{
height:200px;
width:200px;
background:url();
text-indent:-9999px;
}
第二种方法:
.replace-indent{
height:200px;
width:200px;
background:url();
text-indent:100%;
white-space:nowrap;
overflow:hidden;
}
第三种方法:
.replace-indent{
height:0px;
width:200px;
background:url();
padding:200px 0 0 0;
overflow:hidden;
}
第四种方法:before
.replace-indent{
width:image's width;
height:image's height;
overflow:hidden;
}
.replace-indent : before{
content:url();
}
html代码:
<h1 class="replace-indent"><span>hello see</span></h1>
第一种方法:
.replace-indent{
height:200px;
width:200px;
background:url();
}
span{
display:none;
}
第二种方法:
.replace-indent{
height:200px;
width:200px;
background:url();
}
span{
width:0;
height:0;
display:block;
overflow:hidden;
}
第三种方法:
.replace-indent{
height:200px;
width:200px;
background:url();
}
span{
clip-path:polygon(0px 0px,0px 0px,0px 0px,0px 0px,0px 0px);
-webkit-clip-path:polygon(0px 0px,0px 0px,0px 0px,0px 0px,0px 0px);
}
css用背景图来替换文字来达到隐藏文字的目的的更多相关文章
- CSS实现背景图尺寸不随浏览器大小而变化的两种方法
一些网站的首页背景图尺寸不随浏览器缩放而变化,本例使用CSS 实现背景图尺寸不随浏览器缩放而变化,方法一. 把图片作为background,方法二使用img标签.喜欢的朋友可以看看 一些网站的首页 ...
- CSS 实现背景图尺寸不随浏览器缩放而变化
<!-- Author:博客园小dee --> 一些网站的首页背景图尺寸不随浏览器缩放而变化,例如百度个人版的首页,缩放后背景图的尺寸并不改变: 再比如花瓣网( http://www.hu ...
- 第四界css大会 黑魔法-css网格背景、颜色拾取器、遮罩、文字颜色渐变、标题溢出渐变等
1.css网格背景 <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...
- css(html)背景图优化合并
图片本身的优化: 图像质量要求和图像文件大小决定你用什么格式的图片,用较小的图片文件呈现较好的图像质量. 当图片色彩过于丰富且无透明要求时,建议采用jpg格式并保存为较高质量. 当图片色彩过于丰富又有 ...
- CSS实现背景图尺寸不随浏览器缩放而变化
方法一. 把图片作为background,方法二使用img标签.同时要有一张足够大尺寸的图片. 方法一. 把图片作为background 有几个CSS的属性要提一下:background-size:c ...
- css固定背景图位置 实现屏幕滚动时 显示背景图不同区域
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- css background 背景图设置
- css 在背景图上加渐变
<html> <head> <title>我的第一个 HTML 页面</title> <style> .banner { width: %; ...
- vue cli 打包项目造成css背景图路径错误
vue cli做项目的时候难免会碰到,css引用背景图或者css,js之间的相互引用!!!这时候打包后可能会出现一个错误!!如下图: 写法: 错误: 会无端多出一个“/css/static/” 这样就 ...
随机推荐
- 利用SSIS的ForcedExecutionResult 属性 和CheckPoint调试Package
1,ForcedExecutionResult 强制一个package或task执行的结果,共有四种值 None,Success,Failure,Completion,默认值是None,表示不强制返回 ...
- OpenCascade HLR for Pipe Model
OpenCascade HLR for Pipe Model eryar@163.com 摘要Abstract:在工厂辅助设计(Plant Design)或船舶辅助设计(Ship Design)等CA ...
- OpenCascade Matrix
OpenCascade Matrix eryar@163.com 摘要Abstract:本文对矩阵作简要介绍,并结合代码说明OpenCascade矩阵计算类的使用方法. 关键字Key Words:Op ...
- WPF combobox
先写一个数据类Grade.cs using System; using System.Collections.Generic; using System.Linq; using System.Text ...
- spring aop源码实现分析
1. 先分析Advice before执行Cglib2AopProxy的intercept方法: /** * General purpose AOP callback. Used when the t ...
- Tomcat7.0启动报错:java.lang.illegalargumentexception:taglib definition not consisten with specification version
Tomcat7.0启动报错:java.lang.illegalargumentexception:taglib definition not consisten with specification ...
- Android基于mAppWidget实现手绘地图(五)--如何创建地图资源
地图资源可以通过Slicing Tool工具生成,教程如下: 1.打开Eclipse标准版4.3.2,以Java项目形式导入”slicingtool“项目,运行.(必须是eclipse4.3.2及以上 ...
- maven引入json-lib的正确方法
<dependency> <groupId>net.sf.json-lib</groupId> <artifactId>json-lib</art ...
- 【手把手教你全文检索】Lucene索引的【增、删、改、查】
前言 搞检索的,应该多少都会了解Lucene一些,它开源而且简单上手,官方API足够编写些小DEMO.并且根据倒排索引,实现快速检索.本文就简单的实现增量添加索引,删除索引,通过关键字查询,以及更新索 ...
- MVC中使用EF+MySQL
最近一段时间,想在EF中使用MySQL,于是就进行了测试. 我的环境是VS2013+EF6+MySQL5.7.4 首先要下载MySQL For VisualStudio 1.1.4.Connector ...