Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

andyjamesnelson

macrumors 6502
Original poster
Aug 24, 2003
286
0
Jacob's house
Hey I'm making a form:

HTML:
<form method="post" enctype="text/plain" action="">

<p><textarea class="message" name="contact" cols="60" rows="11">
</textarea></p>

<p><input class="submit" type="submit" value="Send"></input></p>

</form>

Without the <p> tags around the textarea and the input so that the html would not validate?

Still this seems a little crazy, not to mention inheriting CSS from <p> with no need for classes.

Andy
 
I'm not sure what you're getting at with the <p> tags, but shouldn't your method be POST, not post?

Are you saying it wouldn't validate without the <p> tags around the form elements?
 
Yes it won't validate without the <p> tags!

Sorry my 1st post wasn't very clear.

It won't validate like this:

HTML:
<form method="post" enctype="text/plain" action="">

<textarea class="message" name="contact" cols="60" rows="11"></textarea>

<input class="submit" type="submit" value="Send"></input>

</form>

But if I add <p> tags around the textarea and the input it will?

Also I think with xhtml strict its post and not POST?

Andy
 
Ok cool yes that works. One to remember for sure!

I am wondering if there is a way of removing the outline that happens on a submit button in Firefox?

Thanks for the tip.
 
Tags like input and textarea are kind of like a span or strong tag. They're inline and need a block parent. With forms you have a few different options. I often go with a fieldset since they are designed for this kind of job. You can also use other block tags like p, div, ol, ul, etc.

You also miss wrote the input tag. It'a a self closing tag,

HTML:
<input ... />
 
Tags like input and textarea are kind of like a span or strong tag. They're inline and need a block parent. With forms you have a few different options. I often go with a fieldset since they are designed for this kind of job. You can also use other block tags like p, div, ol, ul, etc.

So the OP could put the entire form in a <p> or <div> tag, instead of each element?
 
No, the p would have to be inside the form tag, otherwise that wouldn't validate. Form is a block element.

Beat me to it.

P is a block-level element as well but meant for handling the copy text itself, not larger elements on the page like forms.
 
OK, I tracked it down. The answer I gave before is something that works for the border that shows up on links, but apparently doesn't apply to input buttons. Digging through Firefox I found their styling properties for it.

Disclaimer: I'll give the solution, but consider the consequences as well. The highlighting border is an accessibility feature for people using the keyboard to navigate the outline shows them what is currently selected. Applying this solution will result in a less accessible site. /disclaimer.

Code:
input[type="submit"]::-moz-focus-inner {
 border: 0px dotted #0f0;
}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.