简体   繁体   English

如果表格中的单元格中有文本,如何将文本添加到与单元格最右侧对齐的同一个单元格?

[英]If I have text in a cell within a table, how can I add text to the same cell just aligned to the far right of the cell?

If I have text in a cell within a table (that is automatically aligned to the left, which is fine), how can I also add text to the same cell just aligned to the far right of that cell?如果我在表格内的单元格中有文本(自动向左对齐,这很好),我怎样才能将文本添加到与该单元格最右侧对齐的同一个单元格中?

For example, the HTML code below, I need to add an asterisk to the very far right of the cell that currently reads " <td>Ctrl ⌘ N</td> " .例如,下面的 HTML 代码,我需要在当前显示为<td>Ctrl ⌘ N</td>的单元格的最右侧添加一个星号。 How can I do this?我怎样才能做到这一点?

<table class="shortcutTable">
  <tbody>
    <tr>
      <th class="narrow" lang="en">Shortcut</th>
      <th lang="en">Action</th>
    </tr>
    <tr>
      <td>Ctrl ⌘ N</td>
      <td lang="en">Quick Note</td>
    </tr>

The CSS float property will do what you want. CSS float 属性会做你想做的。 If you have a CSS file already linked in your page, you can make a class for it, but if you just want to put it right in with the HTML, try:如果您的页面中已经链接了一个 CSS 文件,您可以为它创建一个类,但如果您只想将其与 HTML 一起放入,请尝试:

<td>Ctrl ⌘ N<span style="float: right">&ast;</span></td>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在表格单元格(td)中定位元素,使得一个元素左对齐而另一个元素对齐? - How can I position elements within a table cell (td) such that one element is left aligned and the other right aligned? 如何在表格单元格中垂直对齐文本? - How do I align my text vertically within a table cell? 如何使文本从表格单元格的底部开始? - How do I make the text start at the bottom within the cell of a table? 我怎样才能得到<a>填补</a> <li> <a>在此表中,以便每个单元格都是一个链接,而不仅仅是文本?</a> - How can I get the <a> element to fill the <li> in this table so that each cell is a link and not just the text? 如何让文本右对齐,但 div 居中对齐? - How can I have text aligned right, but the div aligned center? 如何在5行文本的表格单元格内添加一些“空格前”间距到单行文本 - How can I add some “space before” spacing to a single line of text inside a table cell of 5 lines of text 如何使同一表格单元格中的两个项目具有不同的文本对齐方式? - How do I make two items in the same table cell have different text alignments? 在右对齐的单元格中左对齐文本 - Left align text in right aligned cell 在同一表格单元格中进行选择后,如何添加标签? - how can I add a label after a select in the same table cell? 如何在文本末尾插入文本 <TD> 在一个html表格单元格中 - How can I insert text at the end of a <TD> in a html table cell
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM