带下划线的 HTML 表单用于手写信息

发布于 2024-08-18 09:56:27 字数 375 浏览 9 评论 0原文

我需要用 HTML 制作一些表格,客户需要打印这些表格并手工编写一些条目,然后扫描或传真。

所以我希望有一个像“Sign ____________”这样的签名区域,

如果下划线的长度有限,那么下划线都很好,但是如果我有很多行需要一直穿过页面(或者在某些情况下)怎么办?案例表格单元格),每个前面都有一些文本?

所以:

Item 1: ____________
An Item 2: _________
This is item 3: ____
1 more item: _______

问题是,如果我使用下划线,下划线不会在相同的位置结束,并且看起来错误或者会扭曲单元格的大小。最好的办法是在空白下划线,但这是不可能的。

I need to make some forms in HTML that a customer will need to print and write some entries by hand then scan or fax.

So I want there to be an area for signing like "Sign ____________"

Underscores are all good if the underline is a limited length, but what if I have a number of lines that need to go all the way across the page (or in some cases table cell) with some text in front of each??

So:

Item 1: ____________
An Item 2: _________
This is item 3: ____
1 more item: _______

The trouble is if I use underscores, the underscores don't finish at the same places and it looks wrong or it warps the size of the cell. The best thing would be to underline white space but that's just not possible.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

没︽人懂的悲伤 2024-08-25 09:56:27

因此,构建一些带有 border-bottom 的块元素。这些看起来像下划线,你可以调整颜色、粗细等等。

一个务实的解决方案:我会将每一行设为一个 2 列表,左列(带有文本)的宽度为 0% (这将扩展到最小需要)和右栏(带下划线的空)宽度为 100%(将占用剩余空间);我将一个带有底部边框的空块放入右侧的表格单元格中。

我的这个设计违反了许多其他网页设计师所持有的一些理想。我并不是说这是一个很棒的或非常符合标准的设计,我只是声称它很简单而且很有效。

So build some block elements with a border-bottom. Those will look like underlines and you can play with colors, thicknesses and whatnot.

A pragmatic solution: I would make each line a 2-column table, give the left column (with the text) a width of 0% (which will expand to the minimum needed) and the right column (empty with underline) a width of 100% (which will take up the remaining space); and I'd put an empty block with a bottom border into that right table cell.

This design of mine violates some ideals held by many other Web designers. I'm not saying this is a fantastic or very standards-compliant design, I only claim it's simple and it works.

青萝楚歌 2024-08-25 09:56:27

将其包裹在

 中标签

它将使用等宽字体,因此您的下划线“行”将在同一位置结束。
您可能已经注意到上面的问题中也发生了这种情况;-)

Wrap it in <pre> tags </pre>.

It will use a monospaced font so your underscore 'lines' will end at the same position.
You may have noticed this also happens in your question above ;-)

最冷一天 2024-08-25 09:56:27

尝试使用 CSS 规则,例如

text-decoration: underline;

or

border-bottom: 1px solid black;

Try using a CSS rule like

text-decoration: underline;

or

border-bottom: 1px solid black;
风蛊 2024-08-25 09:56:27

不久前,我自己尝试寻找解决方案。所以,关键是:

最好的办法是在空白处加下划线,但这是不可能的。

实际上可能的,只是 

下面是一个表单示例,其中字段彼此内联放置:

    <div>
      <nobr>
      First name:
      <u>            </u>
      </nobr>
      <nobr>
      Last name:
      <u>            </u>
      </nobr>
      <nobr>
      Contact phone:
      <u>            </u>
      </nobr>
    </div>

这是一个表单示例,其中字段组织在彼此之上,并且 ___ 部分向右,受到 div 右边界的限制,并且不会不必要地换行:

    <!DOCTYPE html>
    <html>
    <style>
    myLn {
    	display: block;
    	width: 30%;
        overflow: hidden;
        white-space: nowrap;
    }
    </style>
    <body>
    
    
    <myLn>
    Name:
    <u>                                                              </u>
    </myLn>
    
    <myLn>
    Address:
    <u>                                                              </u>
    </myLn>
    
    <myLn>
    More info:
    <u>                                                              </u>
    </myLn>
    
    <myLn>
    <u>                                                              </u>
    </myLn>

    </body>
    </html> 

希望有帮助。

Tried to find the solution myself, a while ago. So, the key is:

The best thing would be to underline white space but that's just not possible.

It actually is possibe, just <u> </u> or <u> </u>.

Here's an example of a form, where fields are placed inline to each other:

    <div>
      <nobr>
      First name:
      <u>            </u>
      </nobr>
      <nobr>
      Last name:
      <u>            </u>
      </nobr>
      <nobr>
      Contact phone:
      <u>            </u>
      </nobr>
    </div>

And here's an example of form, where fields are organized on top of each other, and ___ part goes right, is limited by right bondary of div, and doesn't wrap unnecessarily:

    <!DOCTYPE html>
    <html>
    <style>
    myLn {
    	display: block;
    	width: 30%;
        overflow: hidden;
        white-space: nowrap;
    }
    </style>
    <body>
    
    
    <myLn>
    Name:
    <u>                                                              </u>
    </myLn>
    
    <myLn>
    Address:
    <u>                                                              </u>
    </myLn>
    
    <myLn>
    More info:
    <u>                                                              </u>
    </myLn>
    
    <myLn>
    <u>                                                              </u>
    </myLn>

    </body>
    </html> 

Hope it helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文