HTML5 背景的显示区域实现

来源:脚本之家 时间:2021-03-03

这篇文章主要介绍了HTML5 背景的显示区域实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

background-clip 属性规定背景的绘制区域。

默认值: border-box

继承性: no

版本: CSS3

JavaScript 语法: object.style.backgroundClip=“content-box”

background-clip: border-box|padding-box|content-box;

border-box 背景被裁剪到边框盒。 测试

padding-box 背景被裁剪到内边距框。 测试

content-box 背景被裁剪到内容框。

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>背景的显示区域</title>
<style type="text/css">
div {
padding:50px; /* 设置内边距为50px */
border:50px solid rgba(255, 153, 0, 0.6); /* 设置边框宽度为50px */
height:100px;
width:200px;
color:#fff;
font-size:24px;
font-weight:bold;
text-shadow:2px 0 1px #f00,
-2px 0 1px #f00,
0 2px 1px #f00,
0 -2px 1px #f00;
background-image:url(../images/Bridge.jpg); /* 设置背景图像 */
background-position:0 0; /* 背景图像起始位为原点 */
background-repeat:no-repeat; /* 背景图像不平铺 */
-webkit-background-origin:border-box; /* 原点从边框开始(webkit) */
-moz-background-origin:border-box; /* 原点从边框开始(moz) */
background-origin:border-box; /* 原点从边框开始 */

-webkit-background-clip:border-box; /* 背景从边框开始显示(webkit) */
-moz-background-clip:border-box; /* 背景从边框开始显示(moz) */
background-clip:border-box; /* 背景从边框开始显示 */
}
</style>
<body>
<div>内容从这里开始</div>
</body>
</html>

到此这篇关于HTML5 背景的显示区域实现的文章就介绍到这了,更多相关HTML5 背景显示区域内容请搜索脚本之家以前的文章或继续浏览下面的相关文章,希望大家以后多多支持脚本之家!

来源:脚本之家

链接:https://www.jb51.net/html5/734542.html

项目推荐

A5创业网 版权所有

返回顶部