在表格单元格中与CSS直接对齐 [英] align right in a table cell with CSS

查看:103
本文介绍了在表格单元格中与CSS直接对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有像这样的旧经典代码

 < td align =right> 

这说明:它右对齐单元格中的内容。
因此,如果我在这个单元格中放置2个按钮,它们将出现在单元格的正确位置。



但是我重构了CSS,有没有这样的东西正确对齐?

$ p











pre> text-align:right




text-align CSS属性描述
如何在文本中嵌入内容是
在其父块元素中对齐。
text-align不控制块元素本身的
对齐,
只是它们的内联内容。


查看



text-align

 < td class ='alnright'对齐到右边< / td> 

< style>
.alnright {text-align:right; }
< / style>


I have the old classic code like this

<td align="right">

which does what it says: it right aligns the content in the cell. So if I put 2 buttons in this cell, they will appear at the right site of the cell.

But then I was refactoring this to CSS, but there is no such thing as right align? I see text-align, is that the same?

解决方案

Use

text-align: right

The text-align CSS property describes how inline content like text is aligned in its parent block element. text-align does not control the alignment of block elements itself, only their inline content.

See

text-align

<td class='alnright'>text to be aligned to right</td>

<style>
    .alnright { text-align: right; }
</style>

这篇关于在表格单元格中与CSS直接对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆