-2

The stylesheet is linked correctly. I have not done HTML/CSS in ages, however, this seems straight forward. What is not correct?

.box{
width:100px;
height:100px;
}

.box #1{
border: 1px solid red;
}

.box #2{
border: 1px solid blue;
}
<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
The content of the document......
<div class = "box" id = "1"></div>
<div class = "box" id = "2"></div>
</body>
 
</html>

2 Answers2

0

Your css rules address any nested ids inside your divs. it should be

.box#1 {...}
.box#2 {...}
bombyx mori
  • 401
  • 3
  • 4
0

Your selector for the border are nested selector targeting IDs inside of element with the class box.

Instead of:

.box #1 {your css properties;}

try:

#1 {your css properties;}
Max
  • 63
  • 6