目录

border-top-width

描述 (Description)

设置元素顶部边框的宽度。

可能的值 (Possible Values)

  • length - 任何长度单位。 此属性的长度单位可能不是负数。

  • thin - 比设置为medium的边框更薄的边框。

  • medium - 一个比边框更粗的边框,比设置为粗边的边框更薄。

  • thick - 边框比边框设置为中等厚。

适用于 (Applies to)

所有HTML元素。

DOM语法 (DOM Syntax)

object.style.borderTopWidth = "2px";

例子 (Example)

以下是显示所有边框宽度的示例 -

<html>
   <head>
   </head>
   <body>
      <p style = "border-top-width:4px; border-style:solid;">
         This is a solid border whose width is 4px.
      </p>
      <p style = "border-top-width:4pt; border-style:solid;">
         This is a solid border whose width is 4pt.
      </p>
      <p style = "border-top-width:thin; border-style:solid;">
         This is a solid border whose width is thin.
      </p>
      <p style = "border-top-width:medium; border-style:solid;">
         This is a solid border whose width is medium;
      </p>
      <p style = "border-top-width:thick; border-style:solid;">
         This is a solid border whose width is thick.
      </p>
      <p style = "border-bottom-width:4px;
         border-top-width:10px;
         border-left-width: 2px;
         border-right-width:15px;
         border-style:solid;">
         This is a a border with four different width.
      </p>
   </body>
</html> 

这将产生以下结果 -

新页面打开
↑回到顶部↑
WIKI教程 @2018