如何让2个表格垂直对齐 [英] How to get 2 forms to align vertically

查看:181
本文介绍了如何让2个表格垂直对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个HTML文件,其中包含2个表单,目前是相同的。我想要的只是将我的网页分成两半,每个表单都转到一边。所以每个表格应该有自己的一半屏幕,它们应该在这一半中垂直和水平对齐。



它只是没有用完。



我现在有这个: http://www.datafilehost.com/d/a18afce1 [ ^ ]

(不要使用他们的下载管理器)。那里没有可执行文件(是HTML可执行文件吗?)

因为我之前因为附件中有可执行文件而被呻吟...





-Rixterz

Hi,

I have a HTML file which contains 2 forms, which are the same at the moment. All I want is for my web page to be split into 2 halves, and each form goes to one side. So each form should have their own half of the screen, and they should be aligned vertically and horizontally in that half.

It's just not working out.

I currently have this: http://www.datafilehost.com/d/a18afce1[^]
(don't use their download manager). There are no executable files in there (is HTML executable?)
because i've been moaned at before for having executables in my attachments...


-Rixterz

推荐答案

在单个HTML上使用多个表单不是一个好习惯,但是如果你决定了这就是你想要的,而不是使用css列将它们并排放置......

https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_multi-column_layouts [ ^ ]
It is not a good practice to have multiple forms on a single HTML, however if you decided that this what you want, than use css columns to put them side-by-side...
https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_multi-column_layouts[^]


我在各种浏览器和本地与瘦客户端渲染之间进行对齐时遇到了很多麻烦。我通过完全充电所有物体的位置及其大小来解决它。



使用< form style ='position:absolute; top: ## px; left:## px; width:?? px;'>> 强制< form>左上角的位置(DIV /表/等)。



##是一些数值。要将这些表格并排排列,请将顶部设置为相同,等等。



为什么?宽度?我发现另一个问题是声明宽度。虽然使用%作为宽度会非常方便,但我发现它有时不可靠。我建议您在px中定义宽度。



如果它们需要相同的高度,则添加高度:## px



所以 - 现在你将所有这些都放入一个样式表中,你可以在两种表格上使用它,除了移动表格所需的值,这样它们就不会相互重叠(例如,左:10px;与左:510px;)。



还有其他方法可以做到这一点(基于位置:相对,例如。上面允许在位置上的灵活性最小。在我的情况下,它正是我想要的。



我有点混淆你如何将两个表格垂直对齐这些描述意味着它们重叠。



I had been having a lot of trouble with alignment across various browsers and local vs. thin-client rendering. I solved it by taking full charge of the locations of all objects and their sized.

Use the <form style='position:absolute;top:##px;left:##px;width:??px;'>> to force the location of the upper left corners of your <form> (div/table/etc.).

## is some numerical value. To align the forms side-by-side, set the tops the same, etc.

Why the ?? with width? I found another problem was declaring the width. Although using a % for the width would be very handy, I've found it at times unreliable. I suggest you define the width, as well, in px.

If they need to be the same height, then add height:##px

So - now you put all of this into a style sheet, which you can use on both forms, EXCEPT, the values you need to move the forms so they don't overlap one another (e.g., left:10px; vs. left:510px;).

There are other ways to do this (based upon position:relative, for example. The above allows the least flexibility in location. In my case, it's exactly what I wanted.

I'm a bit confuse on how you can have two forms aligned both vertically and horizontally in their respective halves. That description implies they overlap.


这篇关于如何让2个表格垂直对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆