These properties is used for displaying edges of the elements based on usage.
Border property will draw the lines on the element whenever the page gets loaded. But outline property will highlights the element when it gets focused by keyboard navigations.
To apply borders or outlines to specific sides of an element, use the corresponding properties (e.g., border-top
, border-right
, border-bottom
, border-left
It sets the width of the border.
Syntax: border-width: value;
div {
border-width: 2px;
}
It sets the style of the border. Such as dashed, dotted, double, inset, outset, ridge, solid
. To hide border for the element use the value none
.
Syntax: border-style: value;
div {
border-style: solid;
}
It sets the color of the border.
Syntax: border-color: value;
div {
border-color: blue;
}
This will drawn a line around the outside of an element, without affecting its layout or size.
Syntax: outline: value;
or outline: width style color;
input {
outline: 2px dotted green;
}
This will add or apply shadow effect to the edges of the elements.
Syntax: box-shadow: x-offset y-offset blur spread color;
/* New morphism box shadow effect on outset */
.div:hover {
box-shadow: 12px 12px 12px rgba(0,0,0,0.1),
-10px -10px 10px white;
}
/* New morphism box shadow effect on inset */
.div:hover {
box-shadow: 12px 12px 12px rgba(0,0,0,0.1) inset,
-10px -10px 10px white inset;
}