用CSS使长串英文字符自动换行
2015-01-20 16:52
417 查看
在一个单元格内,中文字符如果超出了单元格的宽度,都会自动换行。但奇怪的是,如果全是英文的话,不论你将TD的宽度设为多大,英文字符都不会自动换行,只会一直延伸。如果做英文站点,动态输出内容,这个就麻烦了。
幸好有个简单的办法可以解决:就是用CSS。只需用到:word-break:break-all就可以了。
例如:
<table style="table-layout:fixed">
<tr>
<td width="100" style="word-break:break-all">Mistletoe also known throughout history as the golden bough has several different legends associated with its beginning and its meaning.
Starting back as far as the Celtic Druids you can find more than one story concerning the mystical mistletoe. One such story is their belief that the plant held the soul of the host tree, which was the “holy oak”. During a ceremony, the Druid priests would harvest the mistletoe with a golden sickle to ensure the mistletoe never touched the ground, as it would lose its magical powers. The powers would quickly be absorbed back into the earth. Once the mistletoe was harvested, the priests would have the branches out to the people for them to use against all kinds of evils.
In England, mistletoe at one time was placed over the doorways for good luck. They believed that only happiness could pass underneath the mistletoe, therefore, enemies would hug and seal their peaceful intentions with a kiss of friendship.
all by <a href=http://www.qpsh.com>www.qpsh.com</a>
The ancient Norse people have a wonderful legend centered on the mistletoe. In their legend, the god Odin and his wife Frigga had a son by the name of Balder. Frigga loved her son very dearly. She took steps to ensure that nothing would ever harm him by way of earth, fire, water, or air.
The mistletoe did not fit into any of these categories, so an evil spirit by the name of Loki created an arrow out of mistletoe and gave it to Balder’s brother, Holder. Holder was blind and Loki held onto his hand and shot Balder in the heart with the mistletoe arrow. Balder died.
From this moment on, the legend is told differently in various stories. One is that Balder is brought to life. In another one, he had a Viking’s funeral and was sent to the Otherworld on a burning ship. He was to remain there until it was time for him to come back to earth to start a new era.
From that day, forward, Frigga stated the mistletoe would never harm anyone again and made it a symbol of love and made the promise to bestow a kiss upon everyone who passed beneath it.
</td>
</tr>
</table>
幸好有个简单的办法可以解决:就是用CSS。只需用到:word-break:break-all就可以了。
例如:
<table style="table-layout:fixed">
<tr>
<td width="100" style="word-break:break-all">Mistletoe also known throughout history as the golden bough has several different legends associated with its beginning and its meaning.
Starting back as far as the Celtic Druids you can find more than one story concerning the mystical mistletoe. One such story is their belief that the plant held the soul of the host tree, which was the “holy oak”. During a ceremony, the Druid priests would harvest the mistletoe with a golden sickle to ensure the mistletoe never touched the ground, as it would lose its magical powers. The powers would quickly be absorbed back into the earth. Once the mistletoe was harvested, the priests would have the branches out to the people for them to use against all kinds of evils.
In England, mistletoe at one time was placed over the doorways for good luck. They believed that only happiness could pass underneath the mistletoe, therefore, enemies would hug and seal their peaceful intentions with a kiss of friendship.
all by <a href=http://www.qpsh.com>www.qpsh.com</a>
The ancient Norse people have a wonderful legend centered on the mistletoe. In their legend, the god Odin and his wife Frigga had a son by the name of Balder. Frigga loved her son very dearly. She took steps to ensure that nothing would ever harm him by way of earth, fire, water, or air.
The mistletoe did not fit into any of these categories, so an evil spirit by the name of Loki created an arrow out of mistletoe and gave it to Balder’s brother, Holder. Holder was blind and Loki held onto his hand and shot Balder in the heart with the mistletoe arrow. Balder died.
From this moment on, the legend is told differently in various stories. One is that Balder is brought to life. In another one, he had a Viking’s funeral and was sent to the Otherworld on a burning ship. He was to remain there until it was time for him to come back to earth to start a new era.
From that day, forward, Frigga stated the mistletoe would never harm anyone again and made it a symbol of love and made the promise to bestow a kiss upon everyone who passed beneath it.
</td>
</tr>
</table>
相关文章推荐
- 自动换行问题,而连续的数字和英文字符常常将容器撑大,下面介绍的是CSS如何实现换行的方法
- css 解决英文字符与阿位伯数字自动换行
- css解决英文字符与阿位伯数字自动换行
- css解决英文字符与阿位伯数字自动换行
- css解决英文字符与阿伯数字自动换行
- css解决英文字符与阿伯数字自动换行
- 英文字母自动换行 CSS
- css 纯英文数字自动换行
- (转)解决长串不能自动换行的问题和td中汉字自动换行 && CSS强制不换行
- 解决长串不能自动换行的问题和td中汉字自动换行 && CSS强制不换行
- div 实现长英文字母自动换行CSS
- CSS解决英文自动换行问题
- div+CSS里长英文字母如何自动换行?
- 英文字符自动换行(防止表格撑坏)方法
- css 英文换行 css(word-wrap/break)使纯英文数字自动换行
- CSS设置【强制不换行】【自动换行】【强制英文单词断行】
- 英文字符自动换行(防止表格撑坏)方法
- 使用css让英文文本自动换行
- 解决长串英文字母显示不能自动换行的问题和td中汉字自动换行 && CSS强制不换行
- css实现长英文字母自动换行