I have a form with three radio buttons. I want the layout of the three radio buttons to be all on one line. I have carefully written my form markup to include no returns or soft-returns in the content window (sometimes content windows add returns if they are visible in the composing window). However, when I publish the page, each radio button shows up on its own line. When I look at the page source, there are indeed <br/ > tags inserted just before each <input type=”radio” /> tag. These do not exist in my original markup. Does anyone know why these are being added? I am using a custom theme, but if I activate the TwentyTen theme, the same problem persists, So I’m guessing it has nothing to do with any of the custom theme code.
Are you adding the form code directly to your theme, or are you adding the code to a page or post in WordPress?
If you’re adding the markup in the post/page editor, then you need to understand that in HTML view, any new line will be converted automatically to a
<br/>tag and two new lines together will be converted automatically to a
Therefore, if you are adding the markup to the post/page editor, you will need to use markup like:
<input type="radio"/><input type="radio"/>
<input type="radio"/> <input type="radio"/>
Thanks for this answer. The point that I am making is that I have been very careful to enter my mark-up exactly as you described, with no new lines in the page editor. Literally, I have entered it as one long line of characters, and my form still inserts the
<br />elements. It seems to only add them before each
<input type="radio" />element because I also have a series of three
<input type="text" />elements that do output on one line as intended. I’m wondering if there is some sort of default function that makes radio buttons and checkboxes output on separate lines instead of on one line.
I was having the same problem. Here’s a post that solved it for me:
- The topic ‘Radio button input elements add a <br /> element’ is closed to new replies.