admin管理员组文章数量:1417070
Does anyone have any tips on how to fix the below problem of the labels and text-areas being so unsymmetric? What's the best way to structure a form like this?
I was thinking of having one div floating left (with the labels) and another div with the text areas floating right, but I didn't quite manage to structure it correctly.
Does anyone have any tips on how to fix the below problem of the labels and text-areas being so unsymmetric? What's the best way to structure a form like this?
I was thinking of having one div floating left (with the labels) and another div with the text areas floating right, but I didn't quite manage to structure it correctly.
Share Improve this question asked Apr 12, 2014 at 16:22 user1531921user1531921 1,4424 gold badges20 silver badges38 bronze badges 1-
1
Where is your HTML and CSS, what is the desired appearance, and what have you tried to achieve it? Also note that basically the same question has been asked often, usually spawning a bunch of plicated approach, and sometimes also the logical
table
approach (and religious attacks on it). So please search for old questions; if they don’t directly answer your problem, they probably help to formulate your question better. Oh, and don’t tag questions with javascript or jquery when there is no apparent connection with them. – Jukka K. Korpela Commented Apr 12, 2014 at 17:56
3 Answers
Reset to default 4It was your idea, I just wrote it...
Fiddle
HTML Layout
<div>
<div class="left">
<span>Comment</span>
<span>Tags</span>
<span>Category List</span>
</div>
<div class="right">
<input type="text" />
<input type="text" />
<select></select>
</div>
</div>
CSS
body { background: #222; color: white; }
.left, .right { width: 50%; float: left; }
.left { text-align: right; }
.right { text-align: left; }
span, input, select { display: block; padding: 5px; margin: 5px; }
span { font-family: sans-serif; line-height: 20px; font-weight: bold; }
input { width: 200px; height: 30px; box-sizing:border-box; }
select { width: 200px; height: 30px; box-sizing:border-box; }
The best way is to use BootStrap framework styling issue. you can enter the website and learn more.. alternative way is to put the labels and the input fields (select fields also) in table and they will be organized.
The better to submit BootStrap otherwise use the simple way. and there is no floating issues and that's better!
If you want to use divs, then make them both float:left
and immediately after put <div style="clear:both"></div>
. Then they will be displayed correctly.
Personally I use tables for this though, like in Islam Attrash's answer.
本文标签: javascriptHow to create twocolumn HTML formStack Overflow
版权声明:本文标题:javascript - How to create two-column HTML form - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745253010a2649934.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论