# Help me find my mistake

**URL:** <https://forum.freecodecamp.org/t/help-me-find-my-mistake/409386>\
**Category:** General\
**Created:** [July 13, 2020, 11:57am UTC](https://forum.freecodecamp.org/t/help-me-find-my-mistake/409386 "2020-07-13T11:57:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![preetirajak333](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/preetirajak333/32/155001_2.png) [@preetirajak333](https://forum.freecodecamp.org/u/preetirajak333)\
**Post date:** [July 13, 2020, 11:57am UTC](https://forum.freecodecamp.org/t/help-me-find-my-mistake/409386/1 "2020-07-13T11:57:26Z")

</div>

I tried selecting multiple classes of different elements. Please tell is this method wrong. The link is below

 ![15946410858135763865999692599861](https://global.discourse-cdn.com/freecodecamp/original/3X/8/6/86c2a8623a45e9303c91b69507fe60a6b1a360f1.jpeg)

 ![15946411868686513820112099574955](https://global.discourse-cdn.com/freecodecamp/original/3X/5/9/599c883c94cd1c096934d690346b17bbd04f90a0.jpeg)

 ![15946412549347144035638029481421](https://global.discourse-cdn.com/freecodecamp/original/3X/2/8/286eac2b9bc374fdb792bbfaba7a1dce0219ea42.jpeg)

The style is being applied to only first image.

---

<div class="post-metadata">

**Author:** ![priyanshushrama709](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/priyanshushrama709/32/150721_2.png) [@priyanshushrama709](https://forum.freecodecamp.org/u/priyanshushrama709)\
**Post date:** [July 13, 2020, 12:06pm UTC](https://forum.freecodecamp.org/t/help-me-find-my-mistake/409386/2 "2020-07-13T12:06:47Z")

</div>

When we select class in css we firstly need to prefix class name with a period or dot so during select multiple classes at once we also need to prefix with a dot after comma character.

```auto
.image1 , " **here is your problem**" image2 , " **here is your problem**" image3 {
    /*css code*/
}

```

---

<div class="post-metadata">

**Author:** ![Sky020](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/sky020/32/128093_2.png) [@Sky020](https://forum.freecodecamp.org/u/Sky020)\
**Post date:** [July 13, 2020, 2:26pm UTC](https://forum.freecodecamp.org/t/help-me-find-my-mistake/409386/3 "2020-07-13T14:26:07Z")

</div>

Hello there,

This is how I _generally_ use CSS selectors:

- If there is one element that needs unique styling: Give the element an `id`, and use `#theId` to style it.
- If there are two or more elements that share the same styling: Give the elements the same `class`, and use `.theClass` to style them.
- If the elements are all of the same type of HTML element (eg. `div`, `img`…): Use the `elementName` (eg `div`) to style them.

So, your problem is as @priyanshushrama709 says: You are not using the correct selector for your CSS.  
This selects an element with a `class="image1"`: `.image1 { }`  
This selects an element with an element name `<image2></image2>`: `image2 { }` (which does not exist)

For future posts, please do not paste screenshots of code. This is not easy for others to work with, and you are less likely to get help.

Hope this helps

---

<div class="post-metadata">

**Author:** ![Madan](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/madan/32/152486_2.png) [@Madan](https://forum.freecodecamp.org/u/Madan)\
**Post date:** [July 13, 2020, 2:34pm UTC](https://forum.freecodecamp.org/t/help-me-find-my-mistake/409386/4 "2020-07-13T14:34:35Z")

</div>

> [@Sky020](#):
>
> If the elements are all of the same type of HTML element (eg. `div` , `img` …): Use the `elementName` (eg `div` ) to style them

Hi @Sky020 ,

I’m not getting this point. Unable to understand. Will you please explain this point?

---

<div class="post-metadata">

**Author:** ![Sky020](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/sky020/32/128093_2.png) [@Sky020](https://forum.freecodecamp.org/u/Sky020)\
**Post date:** [July 13, 2020, 2:58pm UTC](https://forum.freecodecamp.org/t/help-me-find-my-mistake/409386/5 "2020-07-13T14:58:54Z")

</div>

For example, say you have this piece of code:

```auto
<img src="fake_source" alt="I am image 1">
<img src="fake_source2" alt="I am image 2">
<img src="fake_source3" alt="I am image 3">

```

If it were me styling them, because they are the same element type (`img`), I would select them like this:

```auto
img {
  width: 100%;
  height: 100%;
}

```

Now, if there was an `img` element I did not want styled like that, I would have 2 options:

1. Overide the `img` styles above, by giving my image an `id="image_i_do_not_want_styled"`, and styling it the specific way I want.

- Example: You have a website that displays images, but you use `img` to give your site a logo, but do not want the logo to be the same style as the main images.

1. Not use the `img` selector, but give each image the same `class="images_I_want_styled"`, and use that as a selector.

Hope this clarifies.

---

<div class="post-metadata">

**Author:** ![Madan](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/madan/32/152486_2.png) [@Madan](https://forum.freecodecamp.org/u/Madan)\
**Post date:** [July 13, 2020, 3:35pm UTC](https://forum.freecodecamp.org/t/help-me-find-my-mistake/409386/6 "2020-07-13T15:35:57Z")

</div>

Thank you. Very well explained. 🥰

---

<div class="post-metadata">

**Author:** ![preetirajak333](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/preetirajak333/32/155001_2.png) [@preetirajak333](https://forum.freecodecamp.org/u/preetirajak333)\
**Post date:** [July 13, 2020, 4:17pm UTC](https://forum.freecodecamp.org/t/help-me-find-my-mistake/409386/7 "2020-07-13T16:17:11Z")

</div>

Thank you everybody for the replies. It helped me. 🙏

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 6:47pm UTC](https://forum.freecodecamp.org/t/help-me-find-my-mistake/409386/8 "2021-06-01T18:47:11Z")

</div>

Closed on June 1, 2021, 6:47pm UTC


