Forms traditionally are entered as blocks. Unfortunately that often takes a lot of the page space.
This post describes a vertical dropdown form which can be exposed only when needed.
Here is a picture of how it might work:
This simple example only displays the values in the form elements, but of course much more can be done.
This picture shows the addition of a file input:
As can be seen there are only 6 elements, but even that number placed horizontally in a header would take much of the width.
This is the code:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> | |
<html xmlns=”http://www.w3.org/1999/xhtml“> | |
<head profile=”http://gmpg.org/xfn/11“> | |
<title>HTML Editor</title> | |
<style> | |
body {margin-left:0;margin-right:0;font:normal normal 800 24px Arial;} | |
a{ text-decoration: }:link { color: rgb(0, 0, 255) }:visited {color :rgb(100, 0,100) }:hover { }:active { } | |
#d2 {position: absolute; left: 300px; top: 10px; border: 1px solid; width: 200px; height: 30px; padding:5px; background:#fffedd; text-align: center} | |
#d3 {position: absolute; left: 300px; top: 51px; border: 1px solid; visibility:hidden; padding: 5px 2px } | |
input, #s1 {padding: 2px; margin: 2px} | |
</style> | |
</head> | |
<body> | |
<div id=”d2” onmouseover = ‘go();‘ >Show</div> | |
<div id=”d3“> | |
<input type=”text” id=”t2” name=”t2” value=”” placeholder=”width“/><br /> | |
<input type=”text” id=”t3” name=”t3” value=”” placeholder=”height“/><br /> | |
<input type=”button” id=”b1” name=”b1” value=”Test” /><br /> | |
<input type=”file” id=”fil” name=”files” /><br /> | |
<input type=’color‘ id=’clr‘ value= “simple color” /><br /> | |
<select id=”s1” name=”s1” onchange=’actn();‘> | |
<option >Options</option> | |
<option >Option1</option> | |
<option >Option2</option> | |
<option >Option3</option> | |
<option >Option4</option> | |
<option >Option5</option> | |
</select> | |
</div> | |
<script type=”text/javascript“> | |
function go() { | |
document.getElementById(“d3”).style.visibility = “visible”; | |
} | |
function actn() { | |
document.getElementById(“d3”).style.visibility = “hidden”; | |
alert(document.getElementById(“t2”).value + “\n” + document.getElementById(“t3”).value + “\n” + document.getElementById(“clr”).value + “\n” + document.getElementById(“s1”).value ); | |
} | |
</script> | |
</body></html> This is a simple app with one function to show the menu and one to display an alert with the input values as well as hiding the menu. The dropdown menu is played by a mouseover. |