廓线(outstyle)
比较常见于表单和链接等 。
outline-style:none; 取消谷歌、360等蓝色边框
:focus 获得焦点的状态, 鼠标的光标就是焦点
.username:focus{ /*获得焦点的状态*/
border:1px dashed pink;
background-color:#FFF7FB;
color:pink;
}
取消表单边框
因为表单在不同浏览器里面, 以后不同的显示方式。
所以, 一般情况下, 我们会把所有的表单都去掉边框。
border: 0 none; 兼容性更好的写法
Label 标签
<label for="txt">搜索一下</label>: <input type="text" id="txt" class="search" value="请输入..." />
这样, 我们点击搜索一下, 光标就跳到了相应id的 input 里面了
完整实例:
般我们在做页面涉及字体的时候,最多就是换个color换个font-family,在空闲时间之时,我们可以自己动手,看看能不能“创造”出一些CSS字体样式呢~体现下字体的文艺范!下面就来说说有关css美化文字的一些常见做法!
透明文字:
用rgba调整透明度
用opacity调整遮罩
这两者区别是用rgba只是对文字有透明度,而opacity对整个div都有遮罩影响
模糊文字
可以用text-shadow喝-webkit-text-fill-color组合,得出模糊文字,如下:
镂空文字
可以用-webkit-text-stroke来给文字外围描边,然后在把文字的填充颜色设置为透明,这样就能只显示出文字的外围的描边
渐变文字
background可以做到渐变颜色
图片背景文字
在一些网站经常看到类似于这样炫酷的效果
以上就是今天要说的一些CSS美化文字方法,还有很多方法,等一一总结出来再给小伙伴们看,谢谢大家支持!
<!doctype html> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> <style type="text/css"> p{ font-family:"宋体"; font-size:14px; } .p2{ font-style:italic; } .p3{ font-weight:bold; } .p4{ font-family:"微软雅黑"; } .p5{ font-size:36px; } </style> </head> <body> <p class="p1">这是第一行(样式为:标签选择器p中的样式)</p> <p class="p2">这是第二行(样式为:斜体)</p> <p class="p3">这是第三行(样式为:加粗)</p> <p class="p4">这是第四行(样式为:字体变成微软雅黑)</p> <p class="p5">这是第五行(样式为:字体大小为36px)</p> </body> </html>
效果演示图如下所示:
1.png
<!doctype html> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> <style type="text/css"> .div1{ width:500px; border:1px solid #000; padding:20px; } .p1{ color:red; } .p2{ text-align:center; } .p3{ line-height:50px; } .p4{ text-indent:2em; } .p5{ text-decoration:line-through; } .div2{ border:1px solid red; padding:20px; }  .img1{ width:70px; height:70px; vertical-align:middle; } </style> </head> <body> <div class="div1"> <p class="p1">这是第一行(样式为: 字体红色)</p> <p class="p2">这是第二行(样式为:居中)</p> <p class="p3">这是第三行(样式为:行高50px)</p> <p class="p4">这是第四行(样式为:缩进2em)</p> <p class="p5">这是第五行(样式为:删除线)</p> <div class="div2"> <img src="tu24.png" alt="" class="img1">这是第六行(样式为:垂直居中) </div> </div> </body> </html>
演示效果如图所示:
2.png
<!doctype html> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> <style type="text/css"> .div1{ width:500px; height:500px; background-color:#F1CCE8; //背景颜色 } .div2{ width:100%; height:100%; background-image:url(tu24.png); // 插入背景图片 background-repeat:no-repeat; //图片不平铺 background-position:center center; //背景图片垂直水平居中 } </style> </head> <body> <div class="div1"> <div class="div2"> </div> </div> </body> </html>
演示效果图:
3.png
<!doctype html> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> <style type="text/css"> .div1{ width:300px; height:300px; background-color:#F1CCE8; padding:20px; } .ul1{ } .ul2{ list-style-type:none; } .ul3{ list-style-image:url(person02.png); list-style-position:outside; } </style> </head> <body> <div class="div1"> <ul class="ul1"> <li>第一队</li> <li>第一队</li> <li>第一队</li> </ul> <ul class="ul2"> <li>第二队</li> <li>第二队</li> <li>第二队</li> </ul> <ul class="ul3"> <li>第三队</li> <li>第三队</li> <li>第三队</li> </ul> </div> </body> </html>
演示效果图为:
4.png
*请认真填写需求信息,我们会在24小时内与您取得联系。