Stuck at HMTL-CSS Attribute Selector for Checkboxes

So I have been stuck with “Use Attribute Selectors to Style Elements” lesson for days now. I have searched the forum for previous solutions but none of them worked for me.

The problem is I keep getting the error message that “The top margins of the checkboxes should be 10px and the bottom margins of the checkboxes should be 15px.”

I just can’t get passed the test even after using the margin clock rotation method and the individual margin-top, margin-right, margin-bottom, and margin-left. I have also removed excess spacing as suggested by previous answers, but still nothing.

Right now, I don’t know if the error is from my end so I really need help with it. Please help!

<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet" type="text/css">
<style>

  .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;
  }

[type='checkbox']{
  margin: 10px 0px 15px 0px;
}
</style>

<h2 class="red-text">CatPhotoApp</h2>
<main>
  <p class="red-text">Click here to view more <a href="#">cat photos</a>.</p>

  <a href="#"><img class="smaller-image thick-green-border" src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back."></a>

  <div class="silver-background">
    <p>Things cats love:</p>
    <ul>
      <li>cat nip</li>
      <li>laser pointers</li>
      <li>lasagna</li>
    </ul>
    <p>Top 3 things cats hate:</p>
    <ol>
      <li>flea treatment</li>
      <li>thunder</li>
      <li>other cats</li>
    </ol>
  </div>

  <form type="checkbox" action="/submit-cat-photo" id="cat-photo-form">
    <label><input type="radio" name="indoor-outdoor" checked> Indoor</label>
    <label><input type="radio" name="indoor-outdoor"> Outdoor</label><br>
    <label><input type="checkbox" name="personality"checked> Loving</label>
    <label><input type="checkbox" name="personality"> Lazy</label>
    <label><input type="checkbox" name="personality"> Energetic</label><br>
    <input type="text" placeholder="cat photo URL" required>
    <button type="submit">Submit</button>
  </form>
</main>

I think that you may have inadvertently changed some other code in the editor with an accidental keystroke or click. If I use your complete code, the tests don’t pass, but if I just copy this from your code and paste it in, then the tests pass. Try resetting the code and only putting this bit in.

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

Wooow, that worked like the problem never existed. Many thanks!

I’m glad I could help. Good job solving the problem and sticking with it even though it got super frustrating. Happy coding!

1 Like