[minor improvement] hidden inputs in the pay button html form take space in the page
See original GitHub issueI noticed that the input of type hidden
in the pay button form, while invisible, still take some space in a page.
I tested it with Firefox 62.0 and Opera 56.0.3051.36.
This can be annoying when you add more optional inputs and/or try to fit the pay button in a contrived space, for example a page footer in my case, as it add seemingly “blank” space on top of the button.
Only solution I came up with was to add a <div style="display: none;">
around the hidden lines (excluding the image obviously). For example :
<form action="https://btcpay.sosthene.net/api/v1/invoices" method="POST">
<input style="width: 209px;" alt="Pay with BtcPay, Self-Hosted Bitcoin Payment Processor" name="submit" src="https://btcpay.sosthene.net/img/paybutton/pay.png" type="image" />
<div style="display: none;">
<input name="storeId" type="hidden" value="2kUDmoLQMrwvxansY2YkhSaKoo2Y91skauJjtfVqzDYH" />
<input name="price" type="hidden" value="10" />
<input name="currency" type="hidden" value="USD" />
<input name="email" type="hidden" value="USD" />
<input name="currency" type="hidden" value="USD" />
</div>
</form>
I don’t know if there is downside to this solution, or a more obvious, simpler way to achieve this result. If not, I’d like to propose a pull request to add this by default when the button’s code is generated.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
How to hide elements without having them take space on ...
I'm using visibility:hidden to hide certain elements, but they still take up space on the page while hidden. How can I make them...
Read more >How to hide an HTML element, but still have it take up ...
visibility: hidden hides the element, but it still takes up space in the ... How do you layout html elements to always line...
Read more ><input type="hidden"> - HTML: HyperText Markup Language
Warning: While the value isn't displayed to the user in the page's content, it is visible—and can be edited—using any browser's developer tools ......
Read more >Hidden Fields Adding White Space - HTML & CSS
Hi guys I have two hidden fields on a form, and for some reason they're adding extra white space to the final page...
Read more >How to eliminate extra space before and after a <form> tag
In this article, we are going to learn how to eliminate the extra space after a form tag in HTML. Approach 1: We...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I see that there are
<br/>
tags generated on your form after each input. You might have a script in your wordpress generating the extra html on input fields in forms…❤️