Requesting help: Use Attribute Selectors to Style Elements

Hey guys, having trouble with this one. Instructions:
Using the type attribute selector, try to give the checkboxes in CatPhotoApp a top margin of 10px and a bottom margin of 15px.

Here’s my code, please let me know if you anything wrong here:

[type='checkbox'] {
    margin= 10px 0px 15px 0px;
  }

please provide your whole code and the challenge link. Next time you can use the Ask for help button and it will create a post including both

I see a syntax error in your code. Do you maybe use the equal sign in writing css rules? don’t you use a colon?


I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums

1 Like

@ieahleen thank you for the feedback, you are right, should’ve used the colon instead of the equals sign after margin. Here’s the entire code:

[type=‘checkbox’] {
margin: 10px 0px 15px 0px;
}
.red-text {
color: red;
}

h2 {
font-family: Lobster, monospace;
}

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

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

.smaller-image {
width: 100px;
}

.silver-background {
background-color: silver;
}

CatPhotoApp

Click here to view more cat photos.

A cute orange cat lying on its back.

Things cats love:

  • cat nip
  • laser pointers
  • lasagna

Top 3 things cats hate:

  1. flea treatment
  2. thunder
  3. other cats
Indoor Outdoor
Loving Lazy Energetic
Submit

Challenge link: https://www.freecodecamp.org/learn/responsive-web-design/basic-css/use-attribute-selectors-to-style-elements

Thank you for the assist, I appreciate it:)

This is still not working for me. What am I doing wrong?

[type='checkbox'] {
      margin-top: 10px;
      margin-bottom: 15px;
      }