html边框线怎么设置(html网页制作的基本步骤)

来源:国外服务器 在您之前已被浏览:1 次
导读:目前正在解读《html边框线怎么设置(html网页制作的基本步骤)》的相关信息,《html边框线怎么设置(html网页制作的基本步骤)》是由用户自行发布的知识型内容!下面请观看由(国外主机 - www.2bp.net)用户发布《html边框线怎么设置(html网页制作的基本步骤)》的详细说明。
笨笨网美国主机,w ww.2 b p .n e t

CSS3图片边框

使用CSS3 border-image 属性,你可以在元素的周围设置图片边框。

一、浏览器支持

表中的数字指定完全支持该属性的第一个浏览器版本。

数字后面的 -webkit- 或者 -moz- 使用时需要指定前缀。

html边框线怎么设置(html网页制作的基本步骤)


二、CSS3 border-image 属性

CSS3 border-image 属性允许您指定要用来代替元素周围的正常边界的图像。属性有三个部分:

作为边框的图片。

在哪里分割图像。

确定中间部分应重复或延伸。

以下面的图像(叫做 “border.png”)为例:

html边框线怎么设置(html网页制作的基本步骤)


原理分析:

border-image 性将图像分割成九个部分,就像一个井字游戏板。然后将角放在拐角处,中间部分按指定的顺序重复或拉伸。

注意:

让border-image 正常工作, 元素也需要设置边框属性!

1. 图像的中间部分重复创建边界,图片作为边框

CSS代码:

在这里,图像的中间部分被延伸来创建边界.

这里是原始图像:

2. 图像的中间部分延伸到创建边界:使用图片作为边框!

实例代码:

#borderimg { border: 10px solid transparent; padding: 15px; -webkit-border-image: url(img/border.png) 30 stretch; /* Safari 3.1-5 */ -o-border-image: url(img/border.png) 30 stretch; /* Opera 11-12.1 */ border-image: url(img/border.png) 30 stretch; }

html边框线怎么设置(html网页制作的基本步骤)


注意: border-image 属性是border-image-source, border-image-slice, border-image-width, border-image-outset 和 border-image-repeat 的缩写.

1. 不同的切片值

不同的切片值完全改变边框的样子:

实例 1

border-image: url(border.png) 50 round;

#borderimg1 {border: 10px solid transparent;padding: 15px;-webkit-border-image: url(img/border.png) 50 round;/* Safari 3.1-5 */-o-border-image: url(img/border.png) 50 round;/* Opera 11-12.1 */border-image: url(img/border.png) 50 round;}

html边框线怎么设置(html网页制作的基本步骤)


实例 2

border-image: url(border.png) 20% round;

#borderimg2 {border: 10px solid transparent;padding: 15px;-webkit-border-image: url(img/border.png) 20% round;/* Safari 3.1-5 */-o-border-image: url(img/border.png) 20% round;/* Opera 11-12.1 */border-image: url(img/border.png) 20% round;}

html边框线怎么设置(html网页制作的基本步骤)


实例 3

border-image: url(border.png) 30% round;

代码如下:

#borderimg3 {border: 10px solid transparent;padding: 15px;-webkit-border-image: url(img/border.png) 30% round;/* Safari 3.1-5 */-o-border-image: url(img/border.png) 30% round;/* Opera 11-12.1 */border-image: url(img/border.png) 30% round;}

html边框线怎么设置(html网页制作的基本步骤)


三、总结

本文基于CSS基础,使用CSS语言,介绍了有关CSS定义图片边框的知识点,从基础的属性概念入手 ,border-image的用法,在实际应用中需要注意的问题,做了详细的讲解。通过一个个实例的演示。希望帮助你更好的学习CSS。

笨笨网美国主机,w ww.2 b p .n e t
提醒:《html边框线怎么设置(html网页制作的基本步骤)》最后刷新时间 2025-03-21 11:17:53,本站为公益型个人网站,仅供个人学习和记录信息,不进行任何商业性质的盈利。如果内容、图片资源失效或内容涉及侵权,请反馈至,我们会及时处理。本站只保证内容的可读性,无法保证真实性,《html边框线怎么设置(html网页制作的基本步骤)》该内容的真实性请自行鉴别。