css里边字体宽度怎么写

html-css011

css里边字体宽度怎么写,第1张

宽度???是字间距?字间距letter-spacing: normal数值

对齐text-align: justify(两端对齐) left(左对齐) right(右对齐) center(居中)

缩进text-indent: 数值px

垂直对齐vertical-align: baseline(基线) sub(下标) super(下标) toptext-topmiddlebottomtext-bottom

词间距word-spacing: normal数值

空格white-space: pre(保留) nowrap(不换行)

显示display:block(块) inline(内嵌) list-item(列表项) run-in(追加部分) compact(紧凑) marker(标记) tableinline-tabletable-raw-grouptable-header-grouptable-footer-grouptable-rawtable-column-grouptable-columntable-celltable-caption(表格标题)

新建一个html文件,命名为test.html,用于讲解css如何使每个字符宽度一样。

2

/6

在test.html文件内,使用div标签创建一行字符,用于测试。

3

/6

在test.html文件内,设置div标签的class属性为strdiv,用于下面设置样式。

4

/6

在test.html文件内,编写<style type="text/css"></style>标签,页面的css样式将写在该标签内。

5

/6

在css标签内,通过class设置div的样式,定义其宽度为200px,背景颜色为灰色,并将text-align属性设置为justify,text-align-last属性设置为justity,实现每个字符宽度一样。

6

/6

在浏览器打开test.html文件,查看实现的效果。

<style>

.justify { text-align: justify width:200px font-size:15px color:red border:1px solid blue height:18px}

.justify > span { display: inline-block /* Opera */ padding-left: 100% }

</style>

<div class="justify">hello,text justify.</div><br/>

<div class="justify">hello,text justify.<span></span></div><br/>

<div class="justify">中文两端对齐</div><br/>

<div class="justify">中文两端对齐<span></span></div>