首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >css3写的一些背景笔记

css3写的一些背景笔记

作者头像
练小习
发布2017-12-29 11:53:16
6570
发布2017-12-29 11:53:16
举报
文章被收录于专栏:练小习的专栏练小习的专栏

用css3实现的一些背景,有时候可以用作信纸效果

<!DOCTYPE html>

<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>css背景------caihong.cc</title>

<style>

body {

font-family: Georgia, serif;

}

.stripes {

height: 250px;

width: 375px;

float: left;

margin: 10px;

-webkit-background-size: 50px 50px;

-moz-background-size: 50px 50px;

background-size: 50px 50px; /* Controls the size of the stripes */

-moz-box-shadow: 1px 1px 8px gray;

-webkit-box-shadow: 1px 1px 8px gray;

box-shadow: 1px 1px 8px gray;

}

.angled {

background-color: #ac0;

background-image: -webkit-gradient(linear, 0 100%, 100% 0,

color-stop(.25, rgba(255, 255, 255, .2)), color-stop(.25, transparent),

color-stop(.5, transparent), color-stop(.5, rgba(255, 255, 255, .2)),

color-stop(.75, rgba(255, 255, 255, .2)), color-stop(.75, transparent),

to(transparent));

background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .2) 25%, transparent 25%,

transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%,

transparent 75%, transparent);

background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, .2) 25%, transparent 25%,

transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%,

transparent 75%, transparent);

background-image: -ms-linear-gradient(45deg, rgba(255, 255, 255, .2) 25%, transparent 25%,

transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%,

transparent 75%, transparent);

background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, .2) 25%, transparent 25%,

transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%,

transparent 75%, transparent);

background-image: linear-gradient(45deg, rgba(255, 255, 255, .2) 25%, transparent 25%,

transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%,

transparent 75%, transparent);

}

.angled-135 {

background-color: #c16;

background-image: -webkit-gradient(linear, 0 0, 100% 100%,

color-stop(.25, rgba(255, 255, 255, .2)), color-stop(.25, transparent),

color-stop(.5, transparent), color-stop(.5, rgba(255, 255, 255, .2)),

color-stop(.75, rgba(255, 255, 255, .2)), color-stop(.75, transparent),

to(transparent));

background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, .2) 25%, transparent 25%,

transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%,

transparent 75%, transparent);

background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, .2) 25%, transparent 25%,

transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%,

transparent 75%, transparent);

background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, .2) 25%, transparent 25%,

transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%,

transparent 75%, transparent);

background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, .2) 25%, transparent 25%,

transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%,

transparent 75%, transparent);

background-image: linear-gradient(-45deg, rgba(255, 255, 255, .2) 25%, transparent 25%,

transparent 50%, rgba(255, 255, 255, .2) 50%, rgba(255, 255, 255, .2) 75%,

transparent 75%, transparent);

}

.horizontal {

background-color: #0ae;

background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(.5, rgba(255, 255, 255, .2)), color-stop(.5, transparent), to(transparent));

background-image: -webkit-linear-gradient(rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);

background-image: -moz-linear-gradient(rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);

background-image: -ms-linear-gradient(rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);

background-image: -o-linear-gradient(rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);

background-image: linear-gradient(rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);

}

.vertical {

background-color: #f90;

background-image: -webkit-gradient(linear, 0 0, 100% 0, color-stop(.5, rgba(255, 255, 255, .2)), color-stop(.5, transparent), to(transparent));

background-image: -webkit-linear-gradient(0deg, rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);

background-image: -moz-linear-gradient(0deg, rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);

background-image: -ms-linear-gradient(0deg, rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);

background-image: -o-linear-gradient(0deg, rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);

background-image: linear-gradient(0deg, rgba(255, 255, 255, .2) 50%, transparent 50%, transparent);

}

.checkered {

background-image: -webkit-gradient(linear, 0 0, 100% 100%, color-stop(.25, #555), color-stop(.25, transparent), to(transparent)),

-webkit-gradient(linear, 0 100%, 100% 0, color-stop(.25, #555), color-stop(.25, transparent), to(transparent)),

-webkit-gradient(linear, 0 0, 100% 100%, color-stop(.75, transparent), color-stop(.75, #555)),

-webkit-gradient(linear, 0 100%, 100% 0, color-stop(.75, transparent), color-stop(.75, #555));

background-image: -webkit-linear-gradient(45deg, #555 25%, transparent 25%, transparent),

-webkit-linear-gradient(-45deg, #555 25%, transparent 25%, transparent),

-webkit-linear-gradient(45deg, transparent 75%, #555 75%),

-webkit-linear-gradient(-45deg, transparent 75%, #555 75%);

background-image: -moz-linear-gradient(45deg, #555 25%, transparent 25%, transparent),

-moz-linear-gradient(-45deg, #555 25%, transparent 25%, transparent),

-moz-linear-gradient(45deg, transparent 75%, #555 75%),

-moz-linear-gradient(-45deg, transparent 75%, #555 75%);

background-image: -ms-linear-gradient(45deg, #555 25%, transparent 25%, transparent),

-ms-linear-gradient(-45deg, #555 25%, transparent 25%, transparent),

-ms-linear-gradient(45deg, transparent 75%, #555 75%),

-ms-linear-gradient(-45deg, transparent 75%, #555 75%);

background-image: -o-linear-gradient(45deg, #555 25%, transparent 25%, transparent),

-o-linear-gradient(-45deg, #555 25%, transparent 25%, transparent),

-o-linear-gradient(45deg, transparent 75%, #555 75%),

-o-linear-gradient(-45deg, transparent 75%, #555 75%);

background-image: linear-gradient(45deg, #555 25%, transparent 25%, transparent),

linear-gradient(-45deg, #555 25%, transparent 25%, transparent),

linear-gradient(45deg, transparent 75%, #555 75%),

linear-gradient(-45deg, transparent 75%, #555 75%);

}

.picnic {

background-color:white;

background-image: -webkit-gradient(linear, 0 0, 0 100%, color-stop(.5, transparent), color-stop(.5, rgba(200, 0, 0, .5)), to(rgba(200, 0, 0, .5))),

-webkit-gradient(linear, 0 0, 100% 0, color-stop(.5, transparent), color-stop(.5, rgba(200, 0, 0, .5)), to(rgba(200, 0, 0, .5)));

background-image: -webkit-linear-gradient(transparent 50%, rgba(200, 0, 0, .5) 50%, rgba(200, 0, 0, .5)),

-webkit-linear-gradient(0deg, transparent 50%, rgba(200, 0, 0, .5) 50%, rgba(200, 0, 0, .5));

background-image: -moz-linear-gradient(transparent 50%, rgba(200, 0, 0, .5) 50%, rgba(200, 0, 0, .5)),

-moz-linear-gradient(0deg, transparent 50%, rgba(200, 0, 0, .5) 50%, rgba(200, 0, 0, .5));

background-image: -ms-linear-gradient(transparent 50%, rgba(200, 0, 0, .5) 50%, rgba(200, 0, 0, .5)),

-ms-linear-gradient(0deg, transparent 50%, rgba(200, 0, 0, .5) 50%, rgba(200, 0, 0, .5));

background-image: -o-linear-gradient(transparent 50%, rgba(200, 0, 0, .5) 50%, rgba(200, 0, 0, .5)),

-o-linear-gradient(0deg, transparent 50%, rgba(200, 0, 0, .5) 50%, rgba(200, 0, 0, .5));

background-image: linear-gradient(transparent 50%, rgba(200, 0, 0, .5) 50%, rgba(200, 0, 0, .5)),

linear-gradient(0deg, transparent 50%, rgba(200, 0, 0, .5) 50%, rgba(200, 0, 0, .5));

}

#footer {

text-align: center;

clear: both;

padding-top: .5em;

border-top: 1px solid #ccc;

font-variant: small-caps;

}

</style>

</head>

<body>

<h1>Stripes &amp; other patterns with CSS3 — no images</h1>

<div class="horizontal stripes"></div>

<div class="vertical stripes"></div>

<div class="picnic stripes"></div>

<div class="angled stripes"></div>

<div class="angled-135 stripes"></div>

<div class="checkered stripes"></div>

</body>

</html>

提示:你可以先修改部分代码再运行。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档