css鼠标悬停显示文字(CSS鼠标经过悬停在图片上时图片上方显示文字)

本文目录
CSS鼠标经过悬停在图片上时图片上方显示文字
参考:[DIV CSS鼠标经过悬停在图片上时图片上方显示文字
***隐藏网址***
css里怎么设置让一段文字隐藏,然后鼠标悬停又出现那段字,如果要用js的话,请把代码详细一点的写出来
把后两个p标签,加上class=“p”,在标签的style里面,增加 display:none;
css里面:
.p hover{
display:block;
}
div+css 鼠标移到图片上显示文字内容
1、首先输入:
《!DOCTYPE html》
《html》
《head》
《meta charset="utf-8" /》
《title》鼠标悬停图片上显示文字 在线演示 www.divcss5.com《/title》
《style》
img{border:0}/* css 注释说明:设置图片边框为0 */
body{behavior:url("csshover.htc");text-align:center;}/* css注释说明:兼容ie6 支持标签使用hover */
2、然后输入:
.divcss5{ position:relative;width:554px; height:346px;margin:0 auto}
.divcss5 a,.divcss5 span{display:none; text-decoration:none}
.divcss5:hover{cursor:pointer}
.divcss5:hover a.now{cursor:pointer; position:absolute; top:0; width:100%; height:100%;
z-index:100; left:0; display:block;}
.divcss5:hover span{ display:block;position:absolute; bottom:0; left:0;color:#FFF;width:554px;
z-index:10;height:36px; line-height:36px; background:#000;filter:alpha(opacity=60);-moz-opacity:0.5;opacity: 0.5;}
/* 设置显示文字定位位置,背景半透明 */
3、然后输入:
《/style》
《/head》
《body》
《div class="divcss5" style="background:url(imgexp.png)"》
《span》文字内容《/span》
《a href="#" class="now"》 《/a》
《/div》
《div class="divcss5" style="background:url(imgexp.png)"》
《span》欢迎访问DIVCSS5网站《/span》
***隐藏网址***
《/div》
《/body》
《/html》
4、然后就可以了。

更多文章:
跷二郎腿太低好吗?想要通过贴墙站改正二郎腿影响的话,有哪些要点需要注意
2026年10月11日 05:10
易语言点击js按钮(易语言网页填表怎样点击链接为“javascript:void(0)“的按钮)
2026年10月11日 03:00
compare with造句(用compared with和compared to造句)
2026年10月10日 23:30
tensorflow与keras对应版本(为什么tensorflow2.8没有keras)
2026年10月10日 22:10
maven仓库jar网站(如何在maven仓库中添加jar包)
2026年10月10日 19:50





