Understanding Borders

Question abourt borders using CSS, In this exmaple you can see a border has been applied. Mosh taiught me whwen you make a border you have to add 3 elements the PX, the type of border, and the background color.

My question is this, if you add the CSS below, the border will not be red, and this is because we never defined the border. Am I understanding this right?

backgroud-color: red; 
.box {
    width: 200px;
    height: 200px;
    background-color: gold;
    border: 1px solid grey```

The border of the box div will be grey in the code below, not red. The background color and color of the border are seperate things, also note you have a typo in your first rule and the last rule is missing a semi-colon

1 Like