HTML HTML Forms Choosing Options Radio Buttons

Kornel L
Kornel L
4,368 Points

Radio buttons and description of it appears in the browser in block instead of inline. Why?

<label>Age: </label>

<input type="radio" id="under_13" value="under_13" name="user_age"><label for="under_13" class="lignt">Under 13</label><br>

<input type="radio" id="over_13" value="over_13" name="user_age"><label for="over_13" class="lignt">13 or over</label>

6 Answers

Doug Hantke
Doug Hantke
10,018 Points

I'm not sure what exactly you're talking about, but I'm assuming you are wondering why they are laid out vertically instead of side-by-side?

The <br> tag is a line-break and pushing the second radio button down.

Nafis Fuad
Nafis Fuad
35,497 Points

Maybe you've commented out the CSS file path or something and that's why the styling is not being applied to the HTML file. It's the default layout that you're seeing in the browser. Hope that helps.

Happy Coding !!!

Kornel L
Kornel L
4,368 Points

Thanks for replying @Doug Hantke. This is how it appears in the browser.

Age:

o

Under 13

o

13 or over

My question is why is it this way?

Age:

o Under 13

o 13 or over

Thank you!

Doug Hantke
Doug Hantke
10,018 Points

My browser is showing it as this:

Age: o Under 13

o 13 or over

Which is how it will appear because of the line break in the code. Otherwise it would all be inline.

Kornel L
Kornel L
4,368 Points

Right that's how it is in the tutorial. My problem is the text 'under 13' is under the radio button not next to it like it should be same problem with '13 or over'. Each text should be next to it's own radio button on the same line, but they are not. So instead of two lines I have four.

Radio button.

under 13

radio button

13 and over

I reedited my previous post to make it visually correct if that helps.

Doug Hantke
Doug Hantke
10,018 Points

Do you have any CSS running that would be changing the format?

David Olson
David Olson
8,690 Points

You spelled the class name wrong. It should read "light" and the block setting is tied to that class.