border-top
Resumen
La propiedad de CSS border-top
es una abreviatura que establece los valores de border-top-color
, border-top-style
(en-US), y border-top-width
(en-US). Estas propiedades las características del borde superior de un elemento.
Los tres valores de la abreviatura pueden ser especificados en cualquier orden, y uno o dos de ellos pueden ser omitidos.
Como con todas las propiedades abreviadas, border-top siempre establece los valores de todas las propiedades que sean posibles, aun si no están especificadas. Establece aquellas que no son especificadas a sus valores por defecto. Esto significa que:
border-top: none thick green;
es lo mismo que
border-top: thick green;
y el valor de border-top-style
(en-US) establecido antes de border-top
es ignorado.
El no especificar la parte de border-style que está destinada a establecer el valor de border-top-style
(en-US) significa que se tomará el valor por defecto, lo que significa que el border-top-style
(en-US) será none.
También hay que tomar en cuenta que en el siguiente bloque de código se ignorará la primer asignación de border-top-style
(en-US) dado que al indicar border-top
se establecerá implicitamente el valor de border-top-style
(en-US) a none
border-top-style: dotted;
border-top: thick green;
Valor inicial | as each of the properties of the shorthand:
|
---|---|
Applies to | all elements. It also applies to ::first-letter . |
Heredable | no |
Valor calculado | as each of the properties of the shorthand:
|
Animation type | as each of the properties of the shorthand: |
Sintaxis
border-top: 1px;
border-top: 2px dotted;
border-top: medium dashed green;
Valores
<br-width>
- See
border-top-width
(en-US). <br-style>
- See
border-top-style
(en-US). <color>
- See
border-top-color
.
Sintaxis formal
border-top =
<line-width> ||
<line-style> ||
<color>
<line-width> =
<length [0,∞]> |
thin |
medium |
thick
<line-style> =
none |
hidden |
dotted |
dashed |
solid |
double |
groove |
ridge |
inset |
outset
<color> =
<absolute-color-base> |
currentcolor |
<system-color> |
<device-cmyk()>
<absolute-color-base> =
<hex-color> (en-US) |
<named-color> |
transparent |
<rgb()> |
<rgba()> |
<hsl()> |
<hsla()> |
<hwb()> |
<lab()> |
<lch()> |
<oklab()> |
<oklch()> |
<color()>
<device-cmyk()> =
device-cmyk( <cmyk-component>{4} [ / <alpha-value> ]? )
<rgb()> =
rgb( [ <percentage> | none ]{3} [ / [ <alpha-value> | none ] ]? ) |
rgb( [ <number> | none ]{3} [ / [ <alpha-value> | none ] ]? )
<hsl()> =
hsl( [ <hue> | none ] [ <percentage> | none ] [ <percentage> | none ] [ / [ <alpha-value> | none ] ]? )
<hwb()> =
hwb( [ <hue> | none ] [ <percentage> | none ] [ <percentage> | none ] [ / [ <alpha-value> | none ] ]? )
<lab()> =
lab( [ <percentage> | <number> | none ] [ <percentage> | <number> | none ] [ <percentage> | <number> | none ] [ / [ <alpha-value> | none ] ]? )
<lch()> =
lch( [ <percentage> | <number> | none ] [ <percentage> | <number> | none ] [ <hue> | none ] [ / [ <alpha-value> | none ] ]? )
<oklab()> =
oklab( [ <percentage> | <number> | none ] [ <percentage> | <number> | none ] [ <percentage> | <number> | none ] [ / [ <alpha-value> | none ] ]? )
<oklch()> =
oklch( [ <percentage> | <number> | none ] [ <percentage> | <number> | none ] [ <hue> | none ] [ / [ <alpha-value> | none ] ]? )
<color()> =
color( <colorspace-params> [ / [ <alpha-value> | none ] ]? )
<cmyk-component> =
<number> |
<percentage>
<alpha-value> =
<number> |
<percentage>
<hue> =
<number> |
<angle> |
none
<colorspace-params> =
<predefined-rgb-params> |
<xyz-params>
<predefined-rgb-params> =
<predefined-rgb> [ <number> | <percentage> | none ]{3}
<xyz-params> =
<xyz-space> [ <number> | none ]{3}
<predefined-rgb> =
srgb |
srgb-linear |
display-p3 |
a98-rgb |
prophoto-rgb |
rec2020
<xyz-space> =
xyz |
xyz-d50 |
xyz-d65
Ejemplos
element {
border-top: 1px solid #000;
}
Especificaciones
Especificación | Status | Comentarios |
---|---|---|
CSS Backgrounds and Borders Module Level 3 La definición de 'border-top' en esta especificación. |
Candidate Recommendation |
No hay cambios directos, aunque la modificación de valores para |
CSS Level 2 (Revision 1) La definición de 'border-top' en esta especificación. |
Recommendation | No hay cambios significativos |
CSS Level 1 La definición de 'border-top' en esta especificación. |
Recommendation | Definición inicial |
Compatibilidad con navegadores
BCD tables only load in the browser