如何使用新行强制文字显示在左侧?

时间:2017-12-11 21:02:47

标签: html css

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

如何修复此问题,以便新行从右到左开始打印? 这是我的代码:

&#13;
&#13;
.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;
}
&#13;
<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>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:1)

使用:

text-align: right;

根据您的示例,将文本对齐到右侧。

&#13;
&#13;
.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;
}
&#13;
<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>
&#13;
&#13;
&#13;