Style Attributes | Border 样式属性|边框:

The different styles that are used in an HTML document are defined between the open and close style tags. An HTML document can have more than one style but every style needs to have its own unique name. The specific name of each style is followed by the style’s specific attributes which are written between open and closed curly brackets like this example:  style-name{specific style attributes}.

HTML文档中使用的不同样式在打开和关闭样式标签之间定义。HTML文档可以有多个样式,但每个样式都需要有自己的唯一名称。每个样式的特定名称后面是样式的特定属性,这些属性写在打开和关闭的大括号之间,如例:样式名称{specific style attributes}。

The border attribute is used to surround an HTML element. Borders can be customized in several different ways which include: width, location, offset, color, etc. 

border属性用于包围HTML元素。可以用几种不同的方式自定义边框,包括:宽度、位置、偏移、颜色等。

Syntax 语法:

The border attribute is written inside brackets as style-name{border:attributes}. The border attribute can be modified in several different ways as indicated below:

边框属性作为样式名{border:attributes}写入括号内。可以通过以下几种不同的方式修改“边框”属性:

The width of every border needs to be specified using a measurement需要使用测量值指定每个边框的宽度:

border:__px, border-left:__px, etc.

The different sides of a border can be defined using the following statements可以使用以下指令定义边框的不同边:

border-left:__px, border-right:__px, border-top:__px, border-bottom:__px.

The border can be defined as either a solid or dashed line by using the statement可以使用以下指令将边框定义为实线或虚线:

border:__ px solid, or border:__ px dashed.

The color of a border can be defined by adding a color code to the statement可以通过向指令中添加颜色代码来定义边框的颜色: 

border:__ px solid blue, border:__ px dashed red, etc.

Example 例:

Continue to the next example: Style Attribute – Padding