HTML CSS 表格背景
我有一个以表格形式呈现的表格。在第三列中,有 4 行用于选择首选联系方式(单选按钮)。我目前正在使用标签在第一行写入此文本。然而,我被告知,它看起来不如使用自定义图像那么好。
该图像应该很好地位于表单内容之间,并带有指向这些单选按钮的箭头。我认为最简单的方法是在列上设置固定宽度,然后将表格的背景图像设置为我给出的图像,并将其定位(带有背景位置)到它应该位于的位置。设置好列宽后,就不会有对齐问题了。
关于如何做到这一点还有其他想法吗?
I have a form which is presented in a table. In the third column, there are 4 rows for selecting the preferred method of contact (radio buttons). I'm currently using a label to write this text in the first row. I'm told, however, it doesn't look as nice as using a custom image.
The image is supposed to sit nicely amongst the form content with an arrow pointing to these radio buttons. I figured the easiest way to do this would be to set a fixed width on the columns then set the table's background image to the image I've been given and position it (with background-position) to where it should sit. With the column widths set, there shouldn't be a problem of alignment.
Any other ideas on how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的建议:不要将背景放在表格上,而是将背景放在 rowspan=3 的表格单元格上,这意味着它将覆盖所有三个单选按钮右侧的区域。下面是一个说明该技术的 HTML 示例。请注意,您需要仔细调整每列(以及随附的表格)的大小,以确保您的图像正确适合。
My suggestion: instead of putting the background on the table, put the background on a table cell with rowspan=3, meaning it will cover the area to the right of all three radio buttons. Here's an HTML sample illustrating the technique. Note that you'll need to carefully size each column (and the enclosing table) to make sure your image fits in properly.