html5页面中用css使表格居中。我用的是dreamweaver cs 6软件

html-css09

html5页面中用css使表格居中。我用的是dreamweaver cs 6软件,第1张

一般都是用层来居中的

.layer1{width:960pxheight:30pxmargin:0px auto}

<div class="layer1">内容</div>

可以用“text-align”属性控制du文字的位置,“center”属性值让文字居中显示。

1、新建html文档,在body标签中添加一个div标签,在div标签中添加p标签,这时文字将会在div标签中靠左显示:

2、为div标签设置“text-align”属性,属性值为“center”,这时文本将会居中显示:

3、想让文本靠右显示,可以为“text-align”属性设置“right”属性值,这时文本将会靠右显示: