# freeCodeCamp Challenge Guide: Add Borders Around Your Elements

**URL:** <https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630>\
**Category:** freeCodeCamp Contributors\
**Tags:** guide\
**Created:** [July 2, 2016, 6:31pm UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630 "2016-07-02T18:31:10Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![camperbot](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/camperbot/32/18364_2.png) [@camperbot](https://forum.freecodecamp.org/u/camperbot)\
**Post date:** [July 2, 2016, 6:31pm UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/1 "2016-07-02T18:31:10Z")

</div>

# [Add Borders Around Your Elements](https://www.freecodecamp.org/learn/responsive-web-design/basic-css/add-borders-around-your-elements)

* * *

## Problem Explanation

To add a custom border around any HTML element, these three properties are used as shown below.

```css
.className {
    border-width: 10px; /*sets the width/thickness of border to 10 pixels*/
    border-color: pink; /*sets the color of the border to pink*/
    border-style: solid; /*sets the style of the border to solid line type*/
 }

```

The same className should be used as the value for class attribute of the HTML element which has to be styled. Good Luck!

* * *

## Solutions

> **Solution 1 (Click to Show/Hide)**
>
> We need to create a class called `thick-green-border`. This class should add a 10px, solid, green border around an HTML element. and after, we need to apply the class to your cat photo.
> 
> We add between `<style>` and `</style>` new class `thick-green-border` with properties:
> 
> ```css
> .thick-green-border {
> border-color: green;
> border-width: 10px;
> border-style: solid;
> }
> 
> ```
> 
> Also, we can add properties this way:
> 
> ```css
> .thick-green-border {
> border: 10px solid green;
> }
> 
> ```
> 
> The final stage is adding this class to image:
> 
> ```html
> <img class="smaller-image thick-green-border" 
> src="https://bit.ly/fcc-relaxing-cat" 
> alt="A cute orange cat lying on its back.">
> 
> ```

---

<div class="post-metadata">

**Author:** ![mikegontarek](https://avatars.discourse-cdn.com/v4/letter/m/eada6e/32.png) [@mikegontarek](https://forum.freecodecamp.org/u/mikegontarek)\
**Post date:** [June 29, 2017, 3:52am UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/2 "2017-06-29T03:52:18Z")

</div>

Can any one help me? Where do I go from here?

 .red-text { color: red; }

h2 {  
font-family: Lobster, Monospace;  
}

p {  
font-size: 16px;  
font-family: Monospace;  
}

.smaller-image {  
width: 100px;  
}

.thick-green-border {  
border-color: green;  
border-width: 10px;  
border-style: solid;

}

## CatPhotoApp

![A cute orange cat lying on its back.](https://global.discourse-cdn.com/freecodecamp/original/3X/6/1/61a3499c5abb165be990aa0c1abd23342e60c663.jpg)

Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.

Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.

---

<div class="post-metadata">

**Author:** ![moebdick90](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@moebdick90](https://forum.freecodecamp.org/u/moebdick90)\
**Post date:** [June 29, 2017, 7:38pm UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/3 "2017-06-29T19:38:02Z")

</div>

Hey Mikegontarek,

I think the extra space between the “border-style:solid;” and " }" (the last curly brace) underneath might be what’s stopping the border from appearing. I had the same issue with this example and it took hours to figure it out. I hope that helps.

Good Luck!

---

<div class="post-metadata">

**Author:** ![rajp1847](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@rajp1847](https://forum.freecodecamp.org/u/rajp1847)\
**Post date:** [July 1, 2017, 2:23am UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/4 "2017-07-01T02:23:45Z")

</div>

I need help please. Will anyone help

---

<div class="post-metadata">

**Author:** ![brosenstrauch](https://avatars.discourse-cdn.com/v4/letter/b/b487fb/32.png) [@brosenstrauch](https://forum.freecodecamp.org/u/brosenstrauch)\
**Post date:** [July 2, 2017, 1:41pm UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/6 "2017-07-02T13:41:25Z")

</div>

What is wrong here?

 .red-text { color: red; }

h2 {  
font-family: Lobster, Monospace;  
}

p {  
font-size: 16px;  
font-family: Monospace;  
}

.smaller-image {  
width: 100px;

.thick-green-border {  
border-color: green;  
border-width: 10px;  
border-style: solid;}

## CatPhotoApp

\<img class=“smaller-image” “thick-green-border” src="[https://bit.ly/fcc-relaxing-cat](https://bit.ly/fcc-relaxing-cat)"  
alt="A cute orange cat lying on its back. "\>

---

<div class="post-metadata">

**Author:** ![kilgora](https://avatars.discourse-cdn.com/v4/letter/k/e99b99/32.png) [@kilgora](https://forum.freecodecamp.org/u/kilgora)\
**Post date:** [July 2, 2017, 9:24pm UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/7 "2017-07-02T21:24:30Z")

</div>

> [@brosenstrauch](#):
>
> \<img class=“smaller-image” “thick-green-border” src=“[https://bit.ly/fcc-relaxing-cat](https://bit.ly/fcc-relaxing-cat)”  
> alt="A cute orange cat lying on its back. "\>

Eliminate the middle quotes in the img class to  
 ![A cute orange cat lying on its back.](https://bit.ly/fcc-relaxing-cat)

---

<div class="post-metadata">

**Author:** ![sahil067](https://avatars.discourse-cdn.com/v4/letter/s/b9e5f3/32.png) [@sahil067](https://forum.freecodecamp.org/u/sahil067)\
**Post date:** [July 4, 2017, 1:11pm UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/9 "2017-07-04T13:11:30Z")

</div>

Pls someone help me , as I dont know where to place the following code:

border-width:10px;  
border-color:green;  
border-style:solid;

---

<div class="post-metadata">

**Author:** ![EmiliocGarcia](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/emiliocgarcia/32/242938_2.png) [@EmiliocGarcia](https://forum.freecodecamp.org/u/EmiliocGarcia)\
**Post date:** [July 4, 2017, 9:02pm UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/10 "2017-07-04T21:02:40Z")

</div>

I pasted my comment here: [https://pastebin.com/NX5R4AXC](https://pastebin.com/NX5R4AXC)

---

<div class="post-metadata">

**Author:** ![AadiStha](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@AadiStha](https://forum.freecodecamp.org/u/AadiStha)\
**Post date:** [July 5, 2017, 4:40pm UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/11 "2017-07-05T16:40:03Z")

</div>

thank you sooo much man

---

<div class="post-metadata">

**Author:** ![humna](https://avatars.discourse-cdn.com/v4/letter/h/b487fb/32.png) [@humna](https://forum.freecodecamp.org/u/humna)\
**Post date:** [July 6, 2017, 10:57am UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/12 "2017-07-06T10:57:22Z")

</div>

hii…please help me in coding

---

<div class="post-metadata">

**Author:** ![jayanz](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@jayanz](https://forum.freecodecamp.org/u/jayanz)\
**Post date:** [July 9, 2017, 8:57am UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/13 "2017-07-09T08:57:28Z")

</div>

All you have to do is reset the code and re-enter it  
I was struggling with it for like 20 minutes until i just decided to redo it

---

<div class="post-metadata">

**Author:** ![TheMarco77](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/themarco77/32/84422_2.png) [@TheMarco77](https://forum.freecodecamp.org/u/TheMarco77)\
**Post date:** [July 9, 2017, 12:56pm UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/14 "2017-07-09T12:56:01Z")

</div>

Thank you so very much @kilgora 🙂

---

<div class="post-metadata">

**Author:** ![cptromeo](https://avatars.discourse-cdn.com/v4/letter/c/9de053/32.png) [@cptromeo](https://forum.freecodecamp.org/u/cptromeo)\
**Post date:** [July 13, 2017, 5:02am UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/15 "2017-07-13T05:02:52Z")

</div>

remember from here on out everything that changes the way a class looks will go under the style. that’s the code just change the parenthesis.

(style)  
.red-text {  
color: red;  
}

h2 {  
font-family: Lobster, Monospace;  
}

p {  
font-size: 16px;  
font-family: Monospace;  
}

.smaller-image {  
width: 100px;  
}  
.thick-green-border {  
border-color: green;  
border-width: 10px;  
border-style: solid;  
;}  
(/style)

---

<div class="post-metadata">

**Author:** ![pharrj](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/pharrj/32/161737_2.png) [@pharrj](https://forum.freecodecamp.org/u/pharrj)\
**Post date:** [July 13, 2017, 2:24pm UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/16 "2017-07-13T14:24:34Z")

</div>

Whatever test is checking this challenge is seemingly buggy. After spending entirely too much time entering and re-entering the css, applying it to the image, resetting the code, etc the only way I could get it to work was to enter a “style” element in my img tag in addition to the css class styling above. I am positive that the css I was entering was correct as I tested it on my own webserver to verify.

Here’s what I did:  
…  
.thick-green-border{  
border-color: green;  
border-width: 10px;  
border-style: solid;  
}

```
</style>

<h2 class="red-text">CatPhotoApp</h2>

<img style="border-color: green; border-width:10px; border-style:solid;" class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back. ">

```

…

---

<div class="post-metadata">

**Author:** ![pharrj](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/pharrj/32/161737_2.png) [@pharrj](https://forum.freecodecamp.org/u/pharrj)\
**Post date:** [July 13, 2017, 5:03pm UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/17 "2017-07-13T17:03:02Z")

</div>

Just read that there was a brief slow-down and outage earlier when I was attempting this challenge. It is possible that is what caused my code not to fire when I posted this message, just wanted to make sure I presented “all the information” in case it’s not a buggy test 😛

---

<div class="post-metadata">

**Author:** ![Dutchman](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dutchman/32/146536_2.png) [@Dutchman](https://forum.freecodecamp.org/u/Dutchman)\
**Post date:** [July 14, 2017, 7:09am UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/18 "2017-07-14T07:09:09Z")

</div>

Here is the correct code. Enjoy

 .thick-green-border { border-color: green; border-width: 10px; border-style: solid; }

.red-text {  
color: red;  
}

h2 {  
font-family: Lobster, Monospace;  
}

p {  
font-size: 16px;  
font-family: Monospace;  
}

.smaller-image {  
width: 100px;  
}

## CatPhotoApp

![A cute orange cat lying on its back.](https://global.discourse-cdn.com/freecodecamp/original/3X/6/1/61a3499c5abb165be990aa0c1abd23342e60c663.jpg)

Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.

Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.

---

<div class="post-metadata">

**Author:** ![Dutchman](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dutchman/32/146536_2.png) [@Dutchman](https://forum.freecodecamp.org/u/Dutchman)\
**Post date:** [July 14, 2017, 7:09am UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/19 "2017-07-14T07:09:43Z")

</div>

Here is the correct snippet my friend.

 .thick-green-border { border-color: green; border-width: 10px; border-style: solid; }

.red-text {  
color: red;  
}

h2 {  
font-family: Lobster, Monospace;  
}

p {  
font-size: 16px;  
font-family: Monospace;  
}

.smaller-image {  
width: 100px;  
}

## CatPhotoApp

![A cute orange cat lying on its back.](https://global.discourse-cdn.com/freecodecamp/original/3X/6/1/61a3499c5abb165be990aa0c1abd23342e60c663.jpg)

Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.

Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.

---

<div class="post-metadata">

**Author:** ![twizzer1030](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/twizzer1030/32/94549_2.png) [@twizzer1030](https://forum.freecodecamp.org/u/twizzer1030)\
**Post date:** [July 16, 2017, 11:34am UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/21 "2017-07-16T11:34:46Z")

</div>

if you notice the code  
**.thick-green-border** is a highlight  
because .smaller-image{ width: 100px; is missing this clossing bracket this one " } "  
thats why cant appear the borders property…  
hope it will help…

---

<div class="post-metadata">

**Author:** ![DzinaHK](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/dzinahk/32/61571_2.png) [@DzinaHK](https://forum.freecodecamp.org/u/DzinaHK)\
**Post date:** [July 18, 2017, 3:12am UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/22 "2017-07-18T03:12:03Z")

</div>

thanks! this worked … just replying to let everyone know!

---

<div class="post-metadata">

**Author:** ![electrounicorn](https://avatars.discourse-cdn.com/v4/letter/e/ecd19e/32.png) [@electrounicorn](https://forum.freecodecamp.org/u/electrounicorn)\
**Post date:** [July 19, 2017, 6:05pm UTC](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630/23 "2017-07-19T18:05:51Z")

</div>

The correct way to do it is:

.thick-green-border {  
border-color: green;  
border-width: 10px;  
border-style: soild;

![A cute orange cat lying on its back.](https://global.discourse-cdn.com/freecodecamp/original/3X/6/1/61a3499c5abb165be990aa0c1abd23342e60c663.jpg)

include THICK-GREEN-BORDER next to smaller image as a class. Hope it helps (:

[Next page](https://forum.freecodecamp.org/t/freecodecamp-challenge-guide-add-borders-around-your-elements/16630.md?page=2)
