# Understanding Borders

**URL:** <https://forum.codewithmosh.com/t/understanding-borders/26375>\
**Category:** HTML/CSS\
**Created:** [May 2, 2024, 5:26pm UTC](https://forum.codewithmosh.com/t/understanding-borders/26375 "2024-05-02T17:26:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![techytony](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@techytony](https://forum.codewithmosh.com/u/techytony)\
**Post date:** [May 2, 2024, 5:26pm UTC](https://forum.codewithmosh.com/t/understanding-borders/26375/1 "2024-05-02T17:26:48Z")

</div>

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?

```auto
backgroud-color: red; 

```

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

---

<div class="post-metadata">

**Author:** ![lucidlear](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/lucidlear/32/5477_2.png) [@lucidlear](https://forum.codewithmosh.com/u/lucidlear)\
**Post date:** [May 2, 2024, 10:31pm UTC](https://forum.codewithmosh.com/t/understanding-borders/26375/2 "2024-05-02T22:31:29Z")

</div>

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
