首页 技术 正文
技术 2022年11月20日
0 收藏 899 点赞 4,627 浏览 1470 个字

(迁移自旧博客2017 08 06)

CSS3 文本效果:

box-shadow:盒子阴影,可以给卡片添加提高美化效果。可广泛应用于内容展示页面。


<div class="card">
<div class="header">
<h1>7</h1>
</div> <div class="container">
<p>January 7, 2017</p>
</div>
</div>
div.card {
width: 250px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
text-align: center;
}div.header {
background-color: #4CAF50;
color: white;
padding: 10px;
font-size: 40px;
}div.container {
padding: 10px;
}

效果如下:


<div class="polaroid">
<img src="rock600x400.jpg" alt="Norway" style="width:100%">
<div class="container">
<p>Hardanger, Norway</p>
</div>
</div>
div.polaroid {
width: 250px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
text-align: center;
}div.container {
padding: 10px;
}

效果如下:

css3 过渡:

最简单的过渡是一个div,给它加上如下代码,便可以从宽度100px华丽的过渡到宽度为300px。

div
{
width:100px;
height:100px;
background:red;
transition:width 2s;
-webkit-transition:width 2s; /* Safari */
}div:hover
{
width:300px;
}

那么再来点高级的,我们经常在页面上看到炫酷的动效,其实仔细分析,你会发现它并不难做,好多华丽的效果甚至都用不到js就能实现,比如下面这个例子。

<div class="box">
<div class="describe">css3</div>
<div class="describe">过渡</div>
</div>
.box {
width: 100px;
height: 60px;
background: #BCEE68;
color:white;
font-weight:bold;
-webkit-transition: width 1s, height 1s,font-size 1s, color 1s,-webkit-transform 1s; /* For Safari 3.1 to 6.0 */
transition: width 1s, height 1s, color 1s,font-size 1s, transform 1s;
}.box:hover {
width: 150px;
height: 90px;
background:#9B30FF;
-webkit-transform: rotate(360deg); /* Chrome, Safari, Opera */
transform: rotate(360deg);
font-size:20px;
}
.describe{
text-align:center;
}

效果非常炫酷,不是静态所以就不上图了,有兴趣的自己试下。可以用作展示页,也可以用作一行导航菜单,会反转变样式的一组菜单很时尚的嘿嘿。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,050
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,533
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,384
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,160
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,795
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,875