Hướng dẫn preserve formatting in html
ExamplePreformatted text: Show
Nội dung chính
Try it Yourself » More "Try it Yourself" examples below. Definition and UsageThe Text in a Also look at:
Browser Support
Global AttributesThe Event AttributesThe More ExamplesExampleHow to create a pre-formatted text with a fixed width (with CSS): This is a pre with a fixed width. It will use as much space as specified. Try it Yourself » Related PagesHTML Tutorial: HTML Text Formatting HTML DOM reference: Pre Object Default CSS SettingsMost browsers will display the Example pre { Try it Yourself » Sometimes you don’t want to trust the browser to render spacing, tabs, and returns on its own. Poetry, formulas, or programming code, for example, may have their meaning changed or be harder to read if the browser is allowed to do its own thing. But there’s an easy workaround you can use: the element. The text betweenandis preserved in its original state and won’t reflow the text when the browser window is resized. The code for this element looks like this:
Advertisement
Advertisement
Advertisement Add New Question
Ask a Question 200 characters left Include your email address to get a message when this question is answered. Submit Advertisement Video
Thanks for submitting a tip for review! Advertisement About This ArticleThanks to all authors for creating a page that has been read 231,037 times. Is this article up to date?How do you preserve formatting in HTML?The element is displayed in a fixed-width font, and the text preserves both spaces and line breaks. The text will be displayed exactly as written in the HTML source code. |