QQ 1640076782

2013年08月29日

css解决外贸网站文章两端对齐的问题

Filed under: 未分类 — 标签:, , — lifengwu @ 2:28 下午

通常情况下,在外贸网站建设过程中,对于文章的排版是一般只是做一个文字大小和行高的设定即可。文章通常是左侧文字是齐的,右侧由于单词的长短不一,多数是参差不齐的,但有客户特别要求所有文章的文字的两端也要对齐,开始以为这个功能实现不了,仔细查阅资料过后才知道原来CSS有一隐藏属情可以解决这一问题。

下面就对这个属情做一个详细的分析:

text-justify : auto | distribute | distribute-all-lines | distribute-center-last | inter-cluster | inter-ideograph | inter-word | kashida | newspaper

不同的取值:
auto : 默认值。允许浏览器代理用户确定使用的两端对齐法则
distribute : 处理空格很像 newspaper ,适用于东亚文档。尤其是泰文
distribute-all-lines : 两端对齐行的方式与 distribute 相同,也同样不包含两段对齐段落的最后一行。适用于表意字文档
distribute-center-last : 未实现
inter-cluster : 调整文本无词间空格的行。这种模式的调整是用于优化亚洲语言文档的
inter-ideograph : 为表意字文本提供完全两端对齐。他增加或减少表意字和词间的空格
inter-word : 通过增加字之间的空格对齐文本。该行为是对齐所有文本行最快的方法。它的两端对齐行为对段落的最后一行无效 kashida : 通过拉长选定点的字符调整文本。这种调整模式是特别为阿拉伯脚本语言提供的。需要IE5.5+支持
newspaper : 通过增加或减少字或字母之间的空格对齐文本。是用于拉丁文字母表两端对齐的最精确格式

例子:

<div style=”font-size:12px;width:500px;text-align:justify;text-justify:auto”>

 if the quality general price didn’t advantage requires more than sales net can always met some do not understand the customer quotation 2, when the product didn’t advantage to focus on selling yourself there used to be a salesman, who signed a Indonesia customer high price all TT payment later to our company has also been praised the salesman

As an important background of the policy, affected by the factors such as weak external demand and domestic structural adjustment, China’s foreign trade has bid farewell to the high-speed growth, in a quite long period of weakness. At the same time, cross-border e-commerce has achieved rapid development, the official can hope to cultivate it into a new growth point of foreign trade and boost exports. </div>