To change border of Div using CSS, you can set the border
style property for the div elements with the values like 1px solid
, 2px solid #FF0000
, 2px dashed rgb(20, 105, 201)
, etc.
The following is the typical CSS code to change border of Div in HTML page using tag name div
.
div {
border: 1px solid;
}
div {
border: 2px solid #FF0000;
}
div {
border: 2px dashed rgb(20, 105, 201);
}
We shall go through some working examples on how to change border of Div using CSS. In the following examples, you may change the value of border and Run the code to visually observe the changes made to the Div elements.
This is an example on how to change border of Div using solid border.
You may edit the following code, and click on Run button.
This is an example on how to change border of Div using solid colored border.
You may edit the following code, and click on Run button.
This is an example on how to change border of Div using dashed colored border.
You may edit the following code, and click on Run button.