CSS Pre tag wrapping

Rather than having scroll bars appear on your pre tag section you can get it to wrap with the following css codes:

Show Plain Text
CSS code
  1. pre {
  2.  white-space: pre-wrap;       /* css-3 */
  3.  white-space: -moz-pre-wrap !important;  /* Mozilla, since 1999 */
  4.  white-space: -pre-wrap;      /* Opera 4-6 */
  5.  white-space: -o-pre-wrap;    /* Opera 7 */
  6.  word-wrap: break-word;       /* Internet Explorer 5.5+ */
  7. }

For those who are after W3C CSS validation it would be better to use a div section to achieve the same result.

Reference Site:

Filed under: Design  Tags: Css

1 Responses to “CSS Pre tag wrapping”

thank you for information

Sorry, comments have been closed for this post.
(default) 11 queries took 9 ms
NrQueryErrorAffectedNum. rowsTook (ms)
1DESCRIBE `posts`17171
2DESCRIBE `comments`11111
3DESCRIBE `tags`221
4DESCRIBE `categories`221
5DESCRIBE `posts_tags`221
6DESCRIBE `categories_posts`221
7SELECT `Post`.`id`, `Post`.`url`, `Post`.`title`, `Post`.`icon`, `Post`.`metadesc`, `Post`.`metakeys`, `Post`.`categories`, `Post`.`tease`, `Post`.`body`, `Post`.`private_body`, `Post`.`created`, `Post`.`modified`, `Post`.`status`, `Post`.`allow_comments`, `Post`.`tags`, `Post`.`hitcount`, `Post`.`hitcount_rss` FROM `posts` AS `Post` WHERE `Post`.`url` = 'css-pre-tag-wrapping' LIMIT 1110
8SELECT `Comment`.`id`, `Comment`.`post_id`, `Comment`.`body`, `Comment`.`author`, `Comment`.`url`, `Comment`.`email`, `Comment`.`ip`, `Comment`.`status`, `Comment`.`junk_score`, `Comment`.`created`, `Comment`.`modified` FROM `comments` AS `Comment` WHERE `Comment`.`status` = 2 AND `Comment`.`post_id` = (10) 112
9SELECT `Tag`.`id`, `Tag`.`tag`, `PostsTag`.`post_id`, `PostsTag`.`tag_id` FROM `tags` AS `Tag` JOIN `posts_tags` AS `PostsTag` ON (`PostsTag`.`post_id` = 10 AND `PostsTag`.`tag_id` = `Tag`.`id`) 111
10SELECT `Category`.`id`, `Category`.`category`, `CategoriesPost`.`post_id`, `CategoriesPost`.`category_id` FROM `categories` AS `Category` JOIN `categories_posts` AS `CategoriesPost` ON (`CategoriesPost`.`post_id` = 10 AND `CategoriesPost`.`category_id` = `Category`.`id`) 110
11UPDATE `posts` AS `Post` SET `Post`.`hitcount` = Post.hitcount + 1 WHERE `Post`.`id` = 1010