HTML中的边框属性

时间:2023-03-08 20:24:04

可以通过边框风格属性border-style设定上下左右边框的风格,该属性用于设置一个元素边框的样式,而且必须用于指定可见的边框。可以使用1到4个关键字,如果四个值都给出了,它们分别用于上、右、下和左边框的样式

如果给出一个值,它将被运用到各边上。

如果两个或三个值给出了,省略了的值与对边相等

也可以分别使用border-top-style、border-bottom-style、border-left-style、border-right-style属性单独设置各边的风格

各边的风格使用的属性值
none:没有边框,无论边框宽度设置为多大
dotted:点线式边框
dashed:破折线式边框
solid:直线式边框
double:双线式边框
groove:槽线式边框
ridge:脊线式边框
inset:内嵌效果的边框
outset:突起效果的边框

 <!--
 可以通过边框风格属性border-style设定上下左右边框的风格,该属性用于设置一个元素边框的样式,而且必须用于指定可见的边框。可以使用1到4个关键字,如果四个值都给出了,它们分别用于上、右、下和左边框的样式

 如果给出一个值,它将被运用到各边上。

 如果两个或三个值给出了,省略了的值与对边相等

 也可以分别使用border-top-style、border-bottom-style、border-left-style、border-right-style属性单独设置各边的风格

 各边的风格使用的属性值
 none:没有边框,无论边框宽度设置为多大
 dotted:点线式边框
 dashed:破折线式边框
 solid:直线式边框
 double:双线式边框
 groove:槽线式边框
 ridge:脊线式边框
 inset:内嵌效果的边框
 outset:突起效果的边框
 -->
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
 <title>边框风格属性</title>
 <style>
     h1{
         border-style:solid;
         border-width:10px 20px 30px 40px;
         border-color:red blue yellow green;
     }
     h2{
         border-style:double solid inset dotted;
     }
     h3{
         border-top-style:solid;
         border-bottom-style:outset;
     }
 </style>
 </head>

 <body>
     <h1>wwwwwwwwwwwwwwwww</h1>
     <h2>wwwwwwwwwwwwwwwww</h2>
     <h3>wwwwwwwwwwwwwwwww</h3>
 </body>
 </html>