Step 1: Create an HTML file step 2: Insert a div inside the body. The code is as follows:
! DOCTYPE html> <html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="Width = device - width, initial - scale = 1.0">
<title>Document</title>
</head>
<body>
<div></div>
</body>
</html>
Copy the code
Step 3: Set the border attributes for the div, set the width and height, and set the border style. Use the border-color attribute to accept four attributes to control the color of the four edges. The code is as follows:
<! DOCTYPE html> <html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="Width = device - width, initial - scale = 1.0">
<title>Document</title>
<style>
div{
width: 100px;
height: 100px;
border-style: solid;
border-color: red pink green yellow;
}
</style>
</head>
<body>
<div></div>
</body>
</html>
Copy the code