Attribute tag not working

My Attribute selector in my css for my radio buttons is not properly adjusting my margins. Instead of the attribute tag showing up blue. It shows up red. I am really new to this. I dont know why it wont work.

<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='radio'] {
    margin: 10px 0px 0px 15px;
  }

</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 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>

@bperrett Welcome to FCC!

Great attempt at styling your page.
It the margins seems to be working fine and it’s being applied for me and there doesn’t seem to be anything wrong with your attribute selector.

Maybe you can reproduce your problem using codepen or on codesandbox and sharing the link?

Thanks!

@pakatagoh

Thank you for the welcome. I am glad to be here.
I thought it was correct. The tutorial I am in keeps telling me I am wrong when I run tests.
Even when I copy and paste straight from the example given.

Would this be considered a bug ?

Super confused :rofl:

Oh it’s from a tutorial. Can you please share the link to the tutorial.

the tutorial link is as follows

https://www.freecodecamp.org/learn/responsive-web-design/basic-css/override-all-other-styles-by-using-important

The code in your initial post is from a different challenge that the one you later have linked to. There are no requirements for any color changes in the attribute selectors challenge.

  1. You are using the wrong value for the type, it should be targeting checkbox, not radio.

  2. You are not giving the correct numbers for the margin, it should be top margin of 10px and a bottom margin of 15px. Remember the values in the shorthand syntax go clock-wise (top, right, bottom, left).

1 Like

Thank you for your help. I cant believe I didn’t see that. Have a wonderful day.