English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
face rule
CSS border propertiesCSS border properties allow you to define the border area of the box. The border can be a predefined style, such as solid, double, dashed, etc.,can also be an image-. The next section will introduce how to set various properties to define the border style (border-style), color (border-color) and thickness (border
border-width) border width attributewidth
p { border-Attribute specifies the width of the border area. It is a shorthand attribute used to set the thickness of all four sides of the element border at the same time. 10width: medium 15px thick }Prueba ver‹/›
Nota:px;-If the border-width uses the default value (medium).
Elborder-styleAttribute sets the border style of the box, for example: solid, dotted, etc. It is a shorthand attribute used to set the line type of all four sides of the element border.
The border-The style attribute can take one of the following values: none, hidden, dashed, dotted, double, groove, inset, outset, ridge, and solid.
none: No border.
dotted: Define the dotted line border
dashed: Define the dashed line border
solid: Define the solid line border
double: define dos bordes. La anchura de los dos bordes es igual a border-El valor de width es el mismo
groove: define3D borde enzogado. El efecto depende del valor del color del borde
ridge: define3D borde ondulado. El efecto depende del valor del color del borde
inset: define3D borde integrado. El efecto depende del valor del color del borde
outset: define3D borde de inicio. El efecto depende del valor del color del borde
p { border-style: dotted; }Prueba ver‹/›
Elborder-colorEl atributo especificacolorBorde del cuadro. También se utiliza para establecer el color de borde de todos los cuatro lados del elemento.
p { border-style: solid; border-color: #ff0000; }Prueba ver‹/›
Nota:border-color Si se utiliza este atributo solo, no tendrá efecto. Utilice border-El atributo style primero establece el borde.
Elborder El atributo de CSS es un atributo de abreviatura que establece uno o más atributos de borde individuales border-style, border-width y border-color en una única regla.
p { border: 5px solid #ff4500; }Prueba ver‹/›
Si se omite o no se especifica el valor de un solo atributo de border al establecer el atributo de abreviatura de border, se utilizará el valor predeterminado de ese atributo (si lo hay).
Nota:border-colorAl establecer el borde del elemento, si falta el valor del atributo o no se especifica el valor del atributo (por ejemplo border: 5px solid;),el elementocolorEl atributo se utilizará como valor border-color。
En este ejemplo, el borde será de anchura5Borde negro en línea recta de px:
p { color: black; border: 5px solid; }Prueba ver‹/›
Pero, con border-En el caso del atributo style, omitir este valor no mostrará ningún borde, porque en este momento border-El valor predeterminado del atributo style es none.
En el siguiente ejemplo, no habrá borde:
p { border: 5px #00ff00; }Prueba ver‹/›