html - 如何强制文本出现在换行符的左侧?

标签 html css

我有一个 <td>嵌套 <p> .当文本超过最大长度时,它会在新行上从右到左打印剩余的文本。 That;s an example

如何解决这个问题,使新行从右到左开始打印? 这是我的代码:

.group {
  border: 2px solid #FFCC00;
  min-width: 250px;
  width: 32.85%;
  margin-bottom: 5px;
  margin-left: 5px;
  padding: 3px;
  float: left;
}

.group article {
  padding: 5px;
  max-height: 350px;
  overflow: auto;
}

.group article table {
  width: 100%;
  border-spacing: 7px;
}
<div class="group">
  <article>
    <header> Links</header>
    <hr/>
    <section>
      <table>
        <tbody>
          <tr>
            <td>
              <p><a href="example.com/" target="_blank">Click here</a></p>
            </td>
            <td>
              <p>Description </p>
            </td>
          </tr>
        </tbody>
      </table>
    </section>
  </article>
</div>

最佳答案

使用:

text-align: right;

将按照您的示例使文本与右侧对齐。

.group {
  border: 2px solid #FFCC00;
  min-width: 250px;
  width: 32.85%;
  margin-bottom: 5px;
  margin-left: 5px;
  padding: 3px;
  float: left;
}

.group article {
  padding: 5px;
  max-height: 350px;
  overflow: auto;
}

.group article table {
  width: 100%;
  border-spacing: 7px;
}

td.right p{
  text-align:right;
}
<div class="group">
  <article>
    <header> Links</header>
    <hr/>
    <section>
      <table>
        <tbody>
          <tr>
            <td>
              <p><a href="example.com/" target="_blank">Click here</a></p>
            </td>
            <td class="right">
              <p>Description lorem ipsum dollar sit amet</p>
            </td>
          </tr>
        </tbody>
      </table>
    </section>
  </article>
</div>

关于html - 如何强制文本出现在换行符的左侧?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47761354/

相关文章:

html - 如何在html中为选定的选项赋予样式

php - 单击时如何使我的删除链接拆分为是/否?

html - 调整网站页脚

php - 调用css、js文件的最佳方式?

CSS - 自定义标题设置

jquery - 对于每个 <ul>,计数 <li> 标签并根据该数字创建元素

html - CSS3 :not() selector not working on sibling element

javascript - 在 iPhone 上的 UIWebView 中即时更改 CSS

html - 显示部分/div 取决于链接中散列# 值之后

javascript - 打印时需要隐藏未选中的框