编程小贴士

给你的编程提供小点子


CSS 强制换行和禁止换行学习

在CSS里,主要有强制换行和禁止换行。

一、强制换行

1、word-break: break-all;       只对英文起作用,以字母作为换行依据。
2、word-wrap: break-word;   只对英文起作用,以单词作为换行依据。
3、white-space: pre-wrap;     只对中文起作用,强制换行。

word-break:break-all 和 word-wrap:break-word都是能使其容器如DIV的内容自动换行,它们的区别在于:

1、word-break:break-all

假设div宽度为450px,它的内容就会到450px自动换行,如果该行末端有个很长的英文单词,它会把单词截断,一部分保持在行尾,另一部分换到下一行。

2、word-wrap:break-word

与上面一样,但区别就是它会把整个单词看成一个整体,如果该行末端宽度不够显示整个单词,它会自动把整个单词放到下一行,而不会把单词截断掉。

二、禁止换行

white-space:nowrap; overflow:hidden; text-overflow:ellipsis;

white-space:nowrap; 是禁止换行。

overflow:hidden; 是让多出的内容隐藏起来,否则多出的内容会撑破容器。

text-overflow:ellipsis; 让多出的内容以省略号…来表达。但是这个属性主要用于IE等浏览器,Opera浏览器用-o-text-overflow:ellipsis; 而Firefox浏览器没有这个功能,多出的内容只能隐藏起来。

 

130 Responses to “ CSS 强制换行和禁止换行学习 ”

  1. see pron说道:

    d7E6dv Wow, marvelous blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your website is excellent, let alone the content!

  2. I will immediately grab your rss as I can not find your email subscription link or e-newsletter service. Do you ave any? Please let me know in order that I could subscribe. Thanks.

  3. tv show online说道:

    This blog is definitely entertaining additionally informative. I have picked a lot of helpful stuff out of it. I ad love to visit it again soon. Cheers!

  4. free dog说道:

    This awesome blog is no doubt entertaining additionally informative. I have chosen helluva handy tips out of this blog. I ad love to visit it over and over again. Thanks a lot!

  5. tra gung hoa tan说道:

    Really enjoyed this article post. Much obliged.

  6. coloring page说道:

    Wow! Thank you! I continuously needed to write on my blog something like that. Can I take a part of your post to my site?

  7. wonderful points altogether, you just gained a emblem new reader. What would you suggest in regards to your submit that you just made some days ago? Any positive?

  8. I think the admin of this website is truly working hard in support of his site, since here every data is quality based data.

  9. Thanks again for the blog post.Really looking forward to read more. Awesome.

  10. Click to read说道:

    Wow! This could be one particular of the most beneficial blogs We have ever arrive across on this subject. Basically Fantastic. I am also an expert in this topic so I can understand your effort.

  11. website说道:

    This website was how do you say it? Relevant!! Finally I ave found something that helped me. Thank you!

  12. buy说道:

    You ave made some decent points there. I checked on the web for more information about the issue and found most people will go along with your views on this site.

  13. w88world说道:

    You can certainly see your enthusiasm in the paintings you write. The world hopes for more passionate writers like you who aren at afraid to mention how they believe. Always go after your heart.

  14. mca money说道:

    You generated some decent points there. I looked on-line for that challenge and identified most people will go coupled with with all of your website.

  15. Major thankies for the blog post.Really looking forward to read more. Will read on

  16. Just added your website to my list of price reading blogs

  17. celadon city说道:

    Just Browsing While I was browsing today I saw a great article concerning

  18. Wow, superb blog layout! How long have you been blogging for? you made blogging look easy. The overall glance of your site is excellent, let alone the content material!

  19. click here说道:

    Wow! This can be one particular of the most useful blogs We ave ever arrive across on this subject. Actually Magnificent. I am also an expert in this topic therefore I can understand your hard work.

  20. private Hire说道:

    Incredible mastewq! This blog looks just like my old one! It as on a entirely different subject but it has pretty much the same page layout and design. Outstanding choice of colors!

  21. Very interesting subject , thanks for posting. Time flies like an arrow. Fruit flies like a banana. by Lisa Grossman.

  22. Wow, wonderful blog structure! How long have you been blogging for? you made running a blog look easy. The full look of your site is fantastic, as well as the content material!

  23. more details说道:

    When someone writes an article he/she maintains the idea

  24. wow, awesome article post.Really thank you!

  25. You are my function designs. Many thanks for the write-up

  26. Share说道:

    ugg sale ugg boots cheap ugg outlet stores genuine ugg boots cheap uggs uk bottes ugg pas cher cheap ugg boots sale goedkope uggs kopen

  27. Modular Kitchens have changed the idea of kitchen nowadays because it has provided household ladies with a comfortable yet a sophisticated space in which they will invest their quality time and space.

  28. her latest blog说道:

    Thanks for sharing, this is a fantastic blog post.Really thank you! Great.

  29. Nwokolo说道:

    Wow, great blog post.Really looking forward to read more. Much obliged.

  30. klm voucher说道:

    Really great info can be found on web blog. That is true wisdom, to know how to alter one as mind when occasion demands it. by Terence.

  31. Muchos Gracias for your post.Thanks Again. Really Cool.

  32. Very good blog post. I certainly love this website. Keep it up!

  33. The majority of of the commentary on this web site dont make sense.

  34. recycling说道:

    Very informative article.Really thank you! Awesome.

  35. There is noticeably a bundle to find out about this. I assume you made sure good factors in features also.

  36. si quan ao说道:

    May I use Wikipedia content in my blog without violating the copyright law?

  37. Wow, incredible blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your site is fantastic, let alone the content!

  38. I value the blog article.Really looking forward to read more. Much obliged.

  39. have a look at说道:

    Only wanna input that you have a very decent site, I love the style it actually stands out.

  40. I went over this internet site and I believe you have a lot of fantastic info, saved to fav (:.

  41. Im thankful for the article post.Really thank you! Much obliged.

  42. Pretty! This has been an extremely wonderful article. Thank you for supplying this info.

  43. This is a list of words, not an essay. you are incompetent

  44. wanted to say that I ave truly enjoyed browsing your blog posts.

  45. It as actually a nice and useful piece of information. I am satisfied that you shared this useful tidbit with us. Please keep us up to date like this. Thank you for sharing.

  46. This is very interesting, You are a very skilled blogger. I have joined your rss feed and look forward to seeking more of your wonderful post. Also, I have shared your web site in my social networks!

  47. IPTV UK说道:

    Your favourite reason appeared to be at the net the simplest

  48. Looking forward to reading more. Great blog article.Really thank you! Awesome.

  49. tips说道:

    There is noticeably a bunch to know about this. I feel you made some nice points in features also.

  50. fitness说道:

    Really appreciate you sharing this post.Thanks Again. Want more.

  51. This blog is obviously interesting as well as factual. I have picked up many useful stuff out of this source. I ad love to return over and over again. Thanks a lot!

  52. This is just what I ave been looking for all day long. Don at stop updating your blog.

  53. baking equipment说道:

    This can be exactly what I had been searching for, thanks

  54. Dencover说道:

    Woh I love your content , bookmarked !.

  55. Wow, awesome blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your website is great, let alone the content!

  56. Crochet说道:

    This particular blog is without a doubt cool and also factual. I have picked a lot of interesting tips out of this blog. I ad love to visit it again and again. Cheers!

  57. Tapete说道:

    I think this web site holds some rattling superb info for everyone . аЂа‹The ground that a good man treads is hallowed.аЂа› by Johann von Goethe.

  58. my page说道:

    There as definately a great deal to learn about this topic. I really like all of the points you ave made.

  59. blue nike说道:

    What could you suggest in regards to your submit that you just made a few days in

  60. School admission说道:

    Thanks for sharing your info. I truly appreciate your efforts and I am waiting for your next post thank you once again.

  61. Waec expo说道:

    Lovely website! I am loving it!! Will be back later to read some more. I am taking your feeds also.

  62. Way cool! Some very valid points! I appreciate you writing this article and the rest of the website is also very good.

  63. Loving the info on this site, you have done great job on the content.

  64. Lastly, a problem that I am passionate about. I ave looked for info of this caliber for the final a number of hrs. Your website is tremendously appreciated.

  65. What would be There?s noticeably a bundle to find out about this. I assume you made certain good points in features also.

  66. Really informative article.Really thank you! Awesome.

  67. You made some nice points there. I looked on the internet for the subject and found most people will consent with your website.

  68. This blog was how do you say it? Relevant!! Finally I have found something that helped me. Appreciate it!

  69. X amateurs film x amateurs gratuit Look into my page film porno gratuit

  70. Apple Reparatur说道:

    There is apparently a bundle to know about this. I suppose you made various good points in features also.

  71. Lovely blog! I am loving it!! Will come back again. I am taking your feeds also.

  72. I value the post.Really looking forward to read more. Cool.

  73. I think this is a real great blog. Really Great.

  74. pagina de ventas说道:

    ppi claims ireland I work for a small business and they don at have a website. What is the easiest, cheapest way to start a professional looking website?.

  75. MTN说道:

    Im obliged for the article.Really thank you!

  76. I was excited to find this site. I need to to thank you for your time for this fantastic read!! I definitely loved every part of it and i also have you book marked to see new stuff in your site.

  77. hotel说道:

    It as difficult to find educated people on this subject, however, you seem like you know what you are talking about! Thanks

  78. You made some first rate points there. I regarded on the web for the difficulty and found most people will go together with with your website.

  79. You made some clear points there. I did a search on the issue and found most persons will agree with your blog.

  80. This is one awesome post.Really thank you! Really Great.

  81. I truly appreciate this blog post. Really Great.

  82. pool builders说道:

    Really informative blog.Much thanks again. Awesome.

  83. Thankyou for this post, I am a big big fan of this internet internet site would like to proceed updated.

  84. to discover his goal then the achievements will be

  85. Your article Desert | trekking-voyage.com write very well, thank you share!

  86. Chapel说道:

    Thank you ever so for you blog post.Thanks Again. Really Great.

  87. go to source说道:

    There is definately a great deal to know about this subject. I love all of the points you ave made.

  88. you can check说道:

    Wow! This can be one particular of the most useful blogs We have ever arrive across on this subject. Actually Wonderful. I am also a specialist in this topic so I can understand your effort.

  89. whatsapp说道:

    Spot on with this write-up, I seriously believe that this website needs a lot more attention. I all probably be back again to see more, thanks for the advice!

  90. Wow, this post is fastidious, my sister is analyzing such things, thus I am going to let know her.|

  91. There is definately a lot to know about this issue. I love all the points you made.

  92. Thanks for the article post.Thanks Again. Cool.

  93. studiya dizayna说道:

    you could have a great blog here! would you prefer to make some invite posts on my weblog?

  94. visit说道:

    This is a excellent blog, would you be interested in doing an interview about just how you designed it? If so e-mail me!

  95. Thanks a lot for the blog article.Much thanks again. Great.

  96. Thanks so much for the post.Really looking forward to read more.

  97. visiting this site dailly and obtain fastidious information from

  98. Zelda说道:

    ones than actual running ones for many people. Some motivational

  99. up the great work! You realize, lots of people are looking round for

  100. Keep up the wonderful piece of work, I read few content on this site and I conceive that your web blog is real interesting and has bands of great information.

  101. SANTOS JERSEY HOME ??????30????????????????5??????????????? | ????????

  102. Help说道:

    Very interesting subject , thanks for posting.

  103. bakedcomfortfood说道:

    You ave received representatives from everywhere in the state right here in San Antonio; so it only generated feeling to drag everybody with each other and start working, he reported.

  104. premium ads说道:

    Thanks for sharing, this is a fantastic article. Awesome.

  105. Thanks again for the blog article.Really thank you!

  106. visit website说道:

    know. The design and style look great though! Hope you get the

  107. see说道:

    Very neat blog.Much thanks again. Really Great.

  108. that would be the end of this report. Here you

  109. this website说道:

    wow, awesome blog post.Really thank you! Really Great.

  110. Very good article! We are linking to this great post on our website. Keep up the great writing.

  111. caratulas CD说道:

    Very good post. I definitely appreciate this site. Stick with it!

  112. Wow, wonderful blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your site is excellent, as well as the content!

  113. visit说道:

    I really liked your article post.Really looking forward to read more. Will read on

  114. I view something genuinely special in this internet site.

  115. Very nice post. I just stumbled upon your blog and wanted to say that I ave truly enjoyed browsing your blog posts. After all I will be subscribing to your feed and I hope you write again very soon!

  116. Really informative article post.Really thank you! Want more.

  117. tham trai san说道:

    Im having a tiny issue. I cant get my reader to pick-up your rss feed, Im using google reader by the way.

  118. When some one searches for his essential thing, so he/she desires to be available that in detail, therefore that thing is maintained over here.

  119. bon tam bang go说道:

    Im grateful for the blog.Really looking forward to read more. Great.

  120. official site说道:

    o no gratis Take a look at my site videncia gratis

  121. Thanks again for the blog article.Much thanks again. Want more.

  122. learn more说道:

    Great, thanks for sharing this post.Really looking forward to read more. Cool.

  123. wow, awesome article.Really thank you! Cool.

  124. Pretty! This has been an incredibly wonderful post. Thank you for supplying these details.

  125. go here说道:

    I truly appreciate this blog.Really thank you! Awesome.

  126. good morning说道:

    Im thankful for the post.Thanks Again. Want more.

  127. Wonderful blog! I found it while surfing around on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I ave been trying for a while but I never seem to get there! Thank you

  128. one other and this design of partnership is a complete great deal extra genuine wanting and passionate. You might effortlessly come about across a right match for your self by way of video

  129. like to find something more safe. Do you have any recommendations?

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>