From: http://myy.helia.fi/~karte/pre-wrap-css3-mozilla-opera-ie.html
Code snippets and poems often use spaces for indenting text. Pre-tag
is used
to display preformatted text on webpages. This makes indenting visible,
but
has the annoying side-effect of disabling wrapping. When wrapping is
disabled, long lines go out of the right side of window, which is never
usefull. This howto explains how you can make preformatted text wrap on
all browsers when making websites. We also learn how to make pre on any
website wrap while browsing the web with mozilla.
Copyright Tero Karvinen www.iki.fi/karvinen
.
Contents of stylesheet pre-wrap.css
:
/* Browser specific (not valid) styles to make preformatted text wrap */
pre {
white-space: pre-wrap; /* css-3 */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
}
This web page includes the style sheet in head:
<link rel="stylesheet" type="text/css" href="pre-wrap.css" />
All the code snippets on this page, such as the style sheet above,
are inside <pre> tags. See how it wraps by resizing your browser
window. (If you make browser window very small, less than 20 characters
wide, text goes outside the window any way.)
Wrap pre on any page with Mozilla userContent.css
Edit $HOME/.mozilla/default/*.slt/chrome/userContent.css in your
favourite editor. The file does not exist by default, you have to create
it. Add
pre {
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
}
It is the same css as above with unrelated browsers removed and
!important added. Important means that values in userContent are used
instead those defined by stylesheets on websites. Close and open
Mozilla. Try a page with pre
but no css with its own. It should wrap, just like all pre-text in any website.
Links and bibliography
pmsyyz 2003-01-12 "I use this for IRC logs..." in Experts Exchange <pre> but not word wrap
.
Akkana Peck: Customizing Mozilla
.
Suignard (ed) / W3C: CSS3 Text Module
- Candidate Recommendation 14 May 2003
Copyright, Notes, Todo
Todo: user stylesheet (!important) to make all pre in any page wrap in Mozilla. Test in Firefox.
Copyright 2004-09-12 Tero Karvinen www.iki.fi/karvinen
. GNU Free Documentation License
Validate XHTML Basic 1.0
分享到:
相关推荐
For making animations more real, I created another project named Android Easing Functions which is an implementations of easing functions on Android. So, we need to dependent that project. Step 1 ...
<br>Frequency Analog Design 2<br>1.2.2 Units for Microwave and Low-Frequency Analog<br>Design 3<br>1.3 Radio Frequency Integrated Circuits Used in a<br>Communications Transceiver 4<br>1.4 Overview 6...
1,01.zip<br>Output<br>显示所有的调试信息(5KB)<END><br>2,02.zip<br>Some general debugging tips<br>一般的调试技巧(11KB)<END><br>3,03.zip<br>Debugging ISAPI extension<br>调试ISAPI扩展(4KB)<END><br>4,04....
英语<BR> g2yykj1<BR> Making a difference<BR> 与同步教案配套使用<BR> <BR> <BR> 70<BR> <BR> <BR> g2yykj3<BR> Art and Architecture<BR> 与同步教案配套使用<BR> <BR> <BR> 71<BR> <BR> <BR> g2yykj5<BR> The ...
6 , chunks.zip<br>This will open a file and read it in "Chunks" of a selected file.<END><br>7 , logging.zip<br>This is a bas that will log installation procedures so the file can be removed later.<END...
on left and right side of a text box.<END><br>40,Assist.zip<br>A simple application with source code which shows how to save the contents of a rich text box without the help of common dialog box.<END>...
1,01.zip<br>Dialogs in DLL<br>在DLL中实现对话框(5KB)<END><br>2,02.zip<br>Export dialogs in MFC Extension DLLs<br>在MFC扩充DLL中输出对话框(12KB)<END><br>3,03.zip<br>Remapping resource script ID's<br>...
DVD, Video, and More <br>Chapter : Making Movies with Movie Maker <br>Chapter : Fun with Media Center <br>Chapter : Troubleshooting Multimedia <br><br><br>Part VI: Managing Files and Folders <br>...
高二英语教学参考进度表<BR> <P> 序号 章节 内容 <P> 1 Unit 1 Making a difference <BR> 2 Unit 2 News media <BR> 3 Unit 3 Art and architecture <BR> 4 Unit 4 A garden of poems <BR> 5 Unit 5 The English ...
1,01.zip<br>Calling Stored Procedures<br>调用存储过程(8KB)<END><br>2,02.zip<br>Create Access data source name dynamically<br>动态创建Access的数据源名(5KB)<END><br>3,03.zip<br>Using DAO to read data ...
------------------------------<br>VC Upper computer monitor<br>Main functions: <br><br>1. Initial parameters valid checking.<br>2. Display non-needle curve in real-time.<br>3. Report making.<br>4. ...
...<br> </httpHandlers><br> ...<br> </system.web><br> ...<br><configuration><br>Making client-side JavaScript code<br>Let us take a look at the default.aspx file that was automatically created in our ...
best-practice solutions for performing type conversions and lexical conversions<br><br>Utility classes that make programming simpler and clearer<br><br>Flexible container libraries that solve common ...
Converting them into <br>Flash now, and your presentations can be played back every where, Windows, <br>Linux, Macintosh and even Hand held PCs, because Flash is the most popular <br>format in the ...
We aim to show you how to<br>bring these together to build a real-world application while avoiding complexity<br>and embracing simplicity. We will help you extend your knowledge of<br>Java and the ...
Upgrade <br/> Like Installation, Only Worse <br/> Making Upgrades Less Painful <br/> Market Maturity and Upgrades <br/> Chapter Summary <br/> Check This <br/> Try This <br/> <br/> Chapter 13....
Introducing the Boost libraries: the next breakthrough in C++ programming<br><br>Boost takes you far beyond the C++ Standard Library, making C++ programming more elegant, robust, and productive....
" <br> Chapter 1 - Another Pleasant Valley Saturday Understanding What Computers Really Do <br> Chapter 2 - Alien Bases Getting Your Arms around Binary and Hexadecimal <br> Chapter 3 - Lifting the ...
" <br> Chapter 1 - Another Pleasant Valley Saturday Understanding What Computers Really Do <br> Chapter 2 - Alien Bases Getting Your Arms around Binary and Hexadecimal <br> Chapter 3 - Lifting the ...
The book also discusses how to do so effectively, making sure to enrich applications in sensible ways.<br><br>In-depth coverage includes<br><br> * Graphics and GUI fundamentals: Dig deep into the ...