Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8469975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:22:58+00:00 2026-06-10T16:22:58+00:00

In IE7 multiple line breaks (using <br /> or <br> ) within a <pre>

  • 0

In IE7 multiple line breaks (using <br /> or <br>) within a <pre> tag will cause IE7 to collapse the breaks into a single break. To demonstrate this you can use the following HTML code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
        <style type="text/css">
            *
            {
                margin: 0px;
                padding: 0px;
            }
            .a, .b
            {
                float: left;
            }
            .b br
            {
                display: block;
            }
        </style>
    </head>
    <body>
        <pre class="a">Line 1a<br /><br />Line 2a</pre>
        <pre class="b">Line 1b<br /><br />Line 2b</pre>
    </body>
</html>

Which will result in: (for IE7)

Line 1a Line 1b
Line 2a
        Line 2b

And will result in: (for other browsers: FF, etc)

Line 1a Line 1b
        Line 2b
Line 2a

As you will see, I can fix that using display: block; on the <br /> tag itself. The problem is though, that then it won’t work in other browsers anymore, thus it is only a fix for IE7 and thus useless since IE7 is not really a major browser and will never be in future.

Although this is just a remark, and instead of a <pre> tag you can better use the CSS code on a <div> tag: white-space: pre-wrap;word-wrap: break-word; to simulate similar behaviour, the question left to answer is how to fix this anyways in a cross-browser way without CSS hacks or specific browser targeted CSS code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T16:23:00+00:00Added an answer on June 10, 2026 at 4:23 pm

    I think you should use IE conditional comments.

    Yes, it’s a specific browser targeted CSS code, but you are writting correct HTML comments. If IE isn’t a compliant browser and decides to read the comments, it’s his problem. Moreover, if that solves your problem, what more do you want?

    Then, you can use

    <!--[if lte IE 7]>
    <style type="text/css">
    .b br{
        display:block;
    }
    </style>
    <![endif]-->
    

    See it here: http://jsfiddle.net/APj3Y/1/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know IE7 & IE8 supposedly have support for using multiple CSS class selectors,
When using multiple button elements in a form, I realised that IE7 sends the
I need to detect IE7 (and IE6) using the user agent string: I have
The following code worked fine in IE7 until I started using IE9.js file. The
Possible Duplicates: Multiple IE instances on one machine. Running IE6, IE7, and IE8 on
IE8 can go into IE7 mode if it needs to. How does jQuery detect
Why in IE7 does it prohibit me from dragging URL's/images links...etc into a TextArea?
I'm using... background:url(menu-bg.png) repeat-x, url(spot.gif) repeat; background:url(spot.gif)\0/; To create multiple background images in Chrome,
In IE7 and IE8, when using a custom web font, text is sometimes rendered
I try to use multiple backgorunds with CSS3 PIE. It works perfect with IE7,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.