Using p and br tags in HTML

Using p and br tags in HTML
0

#1

Hi,

When working through some of the curric last night, I stumbled across another thread regarding the radio buttons and checkboxes code. The person’s code wasn’t being accepted, and the solution was (if I recall correctly) to remove the line break tags (<br>) the person had inserted between labels.

After reading this, I found that I had the same problem: my code wasn’t being accepted because I had put in a <p>. I fixed it buuuttt…

Can someone explain WHY these won’t work? Is it because whatever checks the challenges won’t recognize those additional parts (ie-- it somehow throws off whatever is being looked for) OR becaue <br> and <p> don’t have a place in a form?

How would this matter in a real-world coding situation?

What’s considered best practice?

Note: there are 4 total questions. No pressure to answer all four. I was an English major and current English teacher. We’re wordy. No pun intended. But maybe a little.


#2

Can someone explain WHY these won’t work? Is it because whatever checks the challenges won’t recognize those additional parts (ie-- it somehow throws off whatever is being looked for) OR becaue
and

don’t have a place in a form?

Yes, these tests are looking for something specific. Often what would be a possible perfectly acceptable answer in the real world will fail because it isn’t what the test is expecting. They try to make the tests flexible, but there is a limit until FCC finishes its AI Skynet super-computer. Read the specs very closely and try to do exactly what it tells you, no more, no less.

How would this matter in a real-world coding situation?

It depends. It could not matter at all. Or it could matter because the company for which you work has a very specific style guide or the client has very specific requirements. If you are doing TDD, a change in formatting might break the test (which is kind of what is happening here). It really depends. But as you learn more, you’ll learn when and why. For the tests, follow them closely.

What’s considered best practice?

“Best practice” is sometimes debatable and it is hard to judge without getting more specific. But from what you describe it doesn’t sound like what you were doing was wrong per se, just confusing the test.


#3

What’s TDD?

Also, 4/4-- A+ answer! Thank you!


#4

Test driven development. It’s a building philosophy where you design the test, and then build the component to pass the test. That’s essentially what these FCC challenges are - except that you weren’t involved in designing the test criteria so it can seem a little opaque.