Unusual form HTML, or browser issue? - html

I am experiencing an issue with Firefox (tested with FF5/win, FF6/win, FF5/mac) having wider margins than any other browser I've tested. (IE9/win, Chrome/win, Opera/win, Safari/win, Safari/mac).
Admittedly, the HTML is unusual, I have 5 forms in a row, but I cannot find any documented problems with the idea, or any warning against it.
Here is the code:
HTML
<div style="background-color: rgba(255, 0, 0, 0.5); float: left; height: 82px; padding-left: 5px; padding-top: 12px; width: 502px;">
<span style="color: #514536; font-weight: bold;">Search By Destination:</span><br />
<div id="regions" style="margin-top: 5px;">
<form action="/view-the-collection/" method="post">
<input type="hidden" id="dest" name="dest" value="Caribbean" />
<input type="hidden" id="search" name="search" value="1" />
<button class="imgbtn" type="submit">
<img src="/a/i/pe_carrib_region.jpg" alt="Caribbean" />
</button>
</form>
<form action="/view-the-collection/" method="post">
<input type="hidden" id="dest" name="dest" value="Mexico" />
<input type="hidden" id="search" name="search" value="1" />
<button class="imgbtn" type="submit">
<img src="/a/i/pe_mexico_region.jpg" alt="Mexico" />
</button>
</form>
<form action="/view-the-collection/" method="post">
<input type="hidden" id="dest" name="dest" value="Thailand" />
<input type="hidden" id="search" name="search" value="1" />
<button class="imgbtn" type="submit">
<img src="/a/i/pe_thailand_region.jpg" alt="Thailand" />
</button>
</form>
<form action="/view-the-collection/" method="post">
<input type="hidden" id="dest" name="dest" value="Southern US" />
<input type="hidden" id="search" name="search" value="1" />
<button class="imgbtn" type="submit">
<img src="/a/i/pe_southus_region.jpg" alt="Southern US" />
</button>
</form>
<form action="/view-the-collection/" method="post" style="margin-right: 0px;">
<input type="hidden" id="dest" name="dest" value="Mustique" />
<input type="hidden" id="search" name="search" value="1" />
<button class="imgbtn" type="submit">
<img src="/a/i/pe_mustique_region.jpg" alt="Mustique" />
</button>
</form>
</div>
</div><br style="clear: both;" />
CSS
#container #regions form {
float: left;
margin: 0px 14px 13px 0px;
padding: 0px;
}
For most browsers, it renders like this:
Except in Firefox, which looks like:
I've made sure to remove padding and margins from every element in each of these forms, and it has no effect. I can't for the life of me figure out what is causing this, whether it is a browser incompatibility, or whether what I've coded is completely out of line. Can anyone advise?
Thanks in advance.

Heres a fix. Instead of adding margins to the forms, just set their widths to 97px each, and align the buttons/images to the left!!

Most likely a browser compatibility issue. I would suggest you using a CSS-reset like the HTML5 Boilerplate: http://html5boilerplate.com/

The extra space looks just about wide enough to be inter-word spaces. Does it go away if you try and cull away all whitespace between your HTML tags (ie between the <form>s and between the various parts of each form)?

You can use a very good and well referenced css package called Formalize CSS - Teach your forms some manners! to make the look and feel of your html form elements cross browser and cross os compatibility.

Related

How to avoid the line break between these two forms

I want to avoid line break between the buttons login and Register,So that the two buttons come in the same line
<h1>Are You ready to take the quiz</h1>
<form action="link1">
<input type="submit" value="Login" />
</form>
<form action="link2">
<input type="submit" value="Register" />
</form>
You can use css for that.
form {
display: inline-block;
}
In order to prevent every form element you're using to get inlined, I'd attatch a class to those which you want to inline.
<form class="inline" action="link1">
<input type="submit" value="Login" />
</form>
<form class="inline" action="link2">
<input type="submit" value="Register" />
</form>
form.inline {
display: inline-block;
}
Demo
Here a solution, I used a container : sameLine so evrithing is in that div will be on the same line
.sameLine{white-space: nowrap;}
.sameLine * {
display: inline;
}
<h1>Are You ready to take the quiz</h1>
<div class="sameLine">
<form action="link1">
<input type="submit" value="Login" />
</form>
<form action="link2">
<input type="submit" value="Register" />
</form>
</div>

How to fix html form size?

I've got a table with few forms. The date is submit button:
And this is the same table without form tag(only input type="submit"):
As you can see, form tag adds new line. How can I avoid this?
The code:
<form id="command" action="/wifi/selection" method="POST">
<input type="hidden" name="beginDate" value="2014-06-30">
<input type="hidden" name="endDate" value="">
<input type="hidden" name="apId" value="1824">
<input type="hidden" name="ssidId"
value="42">
<input type="submit" class="btn btn-link"
value=" 2014-06-30" />
<input type="hidden" name="_csrf" value="812810c6-9e41-434c-baec-b4db1680ce7a" />
</form>
Set style="display: inline;" on the form might do it.
try this:
<style type="text/css'>
form {display:inline; margin:0px; padding:0px;}
</style>
This link will help: How to prevent newline/line break within a <form></form>?

Why won't these HTML form buttons display inline?

I am trying to get form buttons to display inline in a row. I am using CSS to style HTML output from someone else's script, so I have to understand the structure in HTML. I can't change it to something I do understand. See the code below.
What are the default styles for these elements when used in this way? I was under the impression that was a block element and was inline. No matter how I try to style this with CSS, I can't change their position (except with a float, which I'd like to avoid in this case). Help! Thank you :)
<html>
<head></head>
<body>
<div class="comment_buttons">
<form class="button discussion__edit" method="get" action="/doku.php#discussion__comment_form">
<div class="no">
<input type="hidden" name="id" value="start" />
<input type="hidden" name="do" value="show" />
<input type="hidden" name="comment" value="edit" />
<input type="hidden" name="cid" value="f871dd5933621b4fe9070bab542ff3ea" />
<input type="submit" value="Edit" class="button" title="Edit" />
</div>
</form>
<form class="button discussion__toogle" method="get" action="/doku.php">
<div class="no">
<input type="hidden" name="id" value="start" />
<input type="hidden" name="do" value="show" />
<input type="hidden" name="comment" value="toogle" />
<input type="hidden" name="cid" value="f871dd5933621b4fe9070bab542ff3ea" />
<input type="submit" value="Hide" class="button" title="Hide" />
</div>
</form>
<form class="button discussion__delete" method="get" action="/doku.php">
<div class="no">
<input type="hidden" name="id" value="start" />
<input type="hidden" name="do" value="show" />
<input type="hidden" name="comment" value="delete" />
<input type="hidden" name="cid" value="f871dd5933621b4fe9070bab542ff3ea" />
<input type="submit" value="Delete" class="button" title="Delete" />
</div>
</form>
</div>
</body>
</html>
The form elements are inline, but the form and the div inside the form are block elements.
So change them to inline:
form, form div { display: inline; }
http://jsfiddle.net/fbCgk/

html form without action, without submit and no javascript

What purpose would a form server that did not have an action ,,
nor did it have a submit or button, and no javascript anywhere on the page..
<form method="post">
<input type="hidden" name="dtsg" value="AQAdsMJX" autocomplete="off" />
<i class="imgprofpic">
<img src="http://abc.com/img.jpg" class="imgCrop img" />
</i>
<a href="/test">
test
</a>
<input type="hidden" autocomplete="off" name="page" value="0" />
<input type="hidden" autocomplete="off" name="last_page" value="0" />
</form>
I would use it for css
<style>
form{
border:1px solid gray;
}
</style>
Still serves a purpose
It may be designed to be read into another page by an ajax call in which the JS would exist on the reading page.

How do I center this form-button block?

I want this form band button to line up horizontally and to sit as a whole in the horizontal center of the page.
How do I set my css?
<form action="signup.php" method="post">
<fieldset>
<label>Email: <label>
<input type="text" name="email" id="email" placeholder='email address' />
<input type="submit" value="Sign Up" class= "button" />
</fieldset>
</form>
Plenty of ways to tackle this. Here is one solution. Though, I do recommend not using inline styles, but here is your form with the CSS.
<form action="signup.php" method="post" style="margin: 0 auto; width: 350px;">
<fieldset>
<label>Email: <label>
<input type="text" name="email" id="email" placeholder='email address' />
<input type="submit" value="Sign Up" class= "button" />
</fieldset>
</form>
I would wrap your inputs in a div and set the div to display:inline in your css. In your css also target your form and set that to margin:auto
something like this:
<div style="width: 300px; margin-left: auto; margin-right:auto;">
<form action="signup.php" method="post">
<fieldset>
<label>Email: <label>
<input type="text" name="email" id="email" placeholder='email address' />
<input type="submit" value="Sign Up" class= "button" />
</fieldset>
</form>
</div>