【问题标题】:Basic html table centering in the left td以左侧 td 为中心的基本 html 表格
【发布时间】:2013-04-08 08:10:26
【问题描述】:

我有一张表,我将尝试以这种方式表示:

-------------------------
| L1 |       R1         | 
------------------------  
| L2 |       R2         |
-------------------------

我的代码如下:

<div data-role="content" id="div1" align="top" style="padding:3 !important;" >  
        <table border="0" align="CENTER" cellspacing="0" width="100%" style="vertical-    align: text-bottom;" >
        <tr>
        <td></td>
        <td>
            <div id="question1" class="question">
                <input type="text" id="question" />
            <Style>
                #question{
                  font:5px;
                  font-family:verdana;
                }
            </style>        
            </div>
        </td></tr><tr>
        <td width="50"><img id="img2" width="40" height="36" style="float:right; margin-top: 0px;" ></td>
        <td style="text-align:center;">
            <div class="ui-grid-b" >
                <div class="ui-block-a"><button id="button1" type="submit" data-theme="b" style="font-size:0.8em;"></button></div>
                <div class="ui-block-b"><button id="button2" type="submit" data-theme="b" style="font-size:0.8em;"></button></div>   
                <div class="ui-block-c"><button id="button3" type="submit" data-theme="b" style="font-size:0.8em;"></button></div>  
            </div>
        </td>
        </tr>
        </table>
</div>

所以基本上我想要做的是,我的表中没有 L1 部分。 R1 有数据,R2 也有。 L2中有一张图片。我想要做的是删除 L1 和 L2 之间的划分,并且 L2 中的图像应该集中在桌子上,而不仅仅是 L2 的 TD。我该怎么做?

我还有一个问题是,在以下代码行中:

<input type="text" id="question" />

当值被填充并且当我在移动设备中查看它时,文本有时会转到下一行。我认为 textarea 是唯一具有多行的 HTML 标签。不知道为什么这里的文字是多行的,我该如何避免?

【问题讨论】:

  • 我需要更多关于输入多行问题的信息,哪个移动浏览器?你有一个活生生的例子吗?当您说输入不支持多行时,您是正确的。
  • 我使用的是 Safari 自带的默认浏览器。我现在没有示例,但是使用我在这里使用的代码 sn-p,当我从我的 jQuery 代码中填充一个值时,我看到文本变成了 2 行。
  • 我把
    我需要查看 CSS、HTML 和一些 jQuery,你能得到一个 jsFiddle 重现问题吗?它仅“有时”发生的事实也无济于事。 'Safari 自带的默认浏览器' 没有任何意义,因为 Safari 是一个浏览器,我认为你是在 iPhone 上尝试这个?
  • 我会尝试把它放在 jsFiddle 上。实际上,当文本长于屏幕宽度时,它一直在发生,所以我说它只是偶尔发生是错误的。我不确定是否可以将 jsFiddle 放在一起,但我在 jQuery 代码中所做的只是 $('question').text = "This is a long text etc....... ...” 是的,我的意思是我在 iPhone 上的默认浏览器上尝试过,这可能不是 Safari:/

标签: html html-table center tablerow


【解决方案1】:

&lt;table border="0"....下方看到这一点

<tr><td></td>

改成

 <tr>
   <td width="50" rowspan="2">
     <img id="img2" width="40" height="36" style="float:right; margin-top: 0px;">
   </td>

然后摆脱最初持有该图像的&lt;td&gt;&lt;/td&gt;

【讨论】:

    猜你喜欢
    相关资源
    最近更新 更多
    热门标签