question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Broken Tests on challenge Basic CSS: Use Attribute Selectors to Style Elements

See original GitHub issue

Describe your problem and how to reproduce it: This is expected to work, and it works in the preview. There is a space before and after the = symbol.

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

It fails tests with this error, although it is expected to pass.

// running tests
The type attribute selector should be used to select the checkboxes.

The same code without the spaces passes.

Add a Link to the page with the problem: https://www.freecodecamp.org/learn/responsive-web-design/basic-css/use-attribute-selectors-to-style-elements

Tell us about your browser and operating system:

  • Browser Name: Google Chrome
  • Browser Version: 79.0.3945.130
  • Operating System: Fedora 31

If possible, add a screenshot here (you can drag and drop, png, jpg, gif, etc. in this box):

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ShaunSHamiltoncommented, Mar 9, 2020

Whilst I agree there is no reason the tests should not pass, I think it is important to note that having space on either side of the = is not good syntax, and could cause issue with integration with SASS. HTML is just so forgiving. https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors

0reactions
Gabriel-J3suscommented, Jul 4, 2020

That was the best solution I found:

`<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-top: 10px; margin-bottom: 15px;

} </style>`

Read more comments on GitHub >

github_iconTop Results From Across the Web

Basic CSS - Use Attribute Selectors to Style Elements - YouTube
In today's tutorial we continue to learn basic CSS as we use attribute selectors to style elements. Enjoy!
Read more >
Use Attribute Selectors to Style Elements Basic CSS via ...
FOLLOW ALONG LINK: https://www.freecodecamp.org/learn/responsive-web-design/ basic - css / use - attribute - selectors-to-style -elementsCheck out the ...
Read more >
Use Attribute Selectors to Style Elements
Can someone provide some insight as to what I'm doing wrong? I thought I needed to add my code between style tags but...
Read more >
6 Selectors
In CSS, pattern matching rules determine which style rules apply to elements in a document. These patterns, called selectors, may range from simple...
Read more >
How to use and create CSS Selectors in Selenium ...
Locating an element using CSS selector may seem a little difficult than using attributes like id, name, link, etc. but it's one of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found