Mdhar9e
Mdhar9e

Reputation: 1376

Break the lines inside the div tag

with the below code i am able to see the line break in the chrome, but not in IE. i just want the same behaviour in IE too.

 break {
           white-space: pre;
        }
<div class="ft13" style="padding-top: 15px" display:inline-block;>
    <break>
    Another difference between the source files of C++ and the source files of Java is that Java source is written in Unicode, 
    a 16-bit international character set standard. If you create an ASCII source file, the Java compiler will treat the ASCII characters as if they were the equivalent Unicode characters. This will be discussed at greater length in Chapter 3.
    </break>
</div>

in IE the above text is displaying like:(without breaks of lines)

Another difference between the source files of C++ and the source files of Java is that Java source is written in Unicode, a 16-bit international character set standard. If you create an ASCII source file, the Java compiler will treat the ASCII characters as if they were the equivalent Unicode characters. This will be discussed at greater length in Chapter 3.

Upvotes: 0

Views: 2150

Answers (7)

Tri Pham
Tri Pham

Reputation: 66

Did you declare doctype for your document?

<!DOCTYPE html>

If true, I think you should try <br> tag or

<br style="line-height:?px; height:?px" /> 

with ?px is how many px you need.

See more at <br /> HTML tag not cross-browser compatible

Upvotes: 0

Vi100
Vi100

Reputation: 4203

You can break a text content in html using the <br/> tag, just like this:

<div>
    This text is in one line <br/>and this on another
</div>

Furthermore, your code is not correct:

 <div class="ft13" style="padding-top: 15px" display:inline-block;>

should be:

 <div class="ft13" style="padding-top: 15px; display:inline-block;">

whatever it means...

Upvotes: 1

Pugazh
Pugazh

Reputation: 9561

Do you mean <pre> ?

<div class="ft13" style="padding-top: 15px; display:inline-block;">
  <pre>
    Another difference between the source files of C++ and the source files of Java is that Java source is written in Unicode,
    a 16-bit international character set standard. If you create an ASCII source file, the Java compiler will treat the ASCII characters as if they were the equivalent Unicode characters. This will be discussed at greater length in Chapter 3.
  </pre>
</div>

Upvotes: 0

tzi
tzi

Reputation: 9479

By default, IE do not allow you to style a custom element.

You can fix it by creating an instance of the tag in JavaScript.

<!--[if lt IE 9]>
    <script type="text/javascript">
        document.createElement('break');
    </script>
<![endif]-->

This script should be in the <head> of your page in a conditional comment and after any stylesheets.

This solution is inspired by html5shiv that allows you tu use HTML5 tags in IE. You could probably also use it to enable custom elements.

You can learn more about this "hack" in this article: How to get HTML5 working in IE

Upvotes: 1

alenka131
alenka131

Reputation: 32

<style type="text/css">
  .break {
    white-space: pre;
  }
</style>

<div class="ft13" style="padding-top: 15px; display:inline-block;">
  <div class="break">
    Another difference between the source files of C++ and the source files of Java is that Java source is written in Unicode,
  </div>
  <div class="break"> 
    a 16-bit international character set standard. If you create an ASCII source file, the Java compiler will treat the ASCII characters as if they were the equivalent Unicode characters. This will be discussed at greater length in Chapter 3.
  </div>
</div>

Upvotes: 2

Kiran Dash
Kiran Dash

Reputation: 4956

Add white-space:normal;

https://jsfiddle.net/kirandash/v5d9fd0r/

HTML:

<div class="ft13" style="padding-top: 15px; display:inline-block;">
<break>
Another difference between the source files of C++ and the source files of Java is that Java source is written in Unicode, 
a 16-bit international character set standard. If you create an ASCII source file, the Java compiler will treat the ASCII characters as if they were the equivalent Unicode characters. This will be discussed at greater length in Chapter 3.
</break>
</div>

CSS:

break {
       white-space: normal;
    }

OTHERWISE

There is no need of custom break element. You can create line breaks using the <br/> tag.

HTML:

<div class="ft13" style="padding-top: 15px; display:inline-block;">
Another difference between the source files of C++<br/> and the source files of Java is that Java source is written in Unicode, a 16-bit<br/> international character set standard. If you create an ASCII source file,<br/> the Java compiler will treat the ASCII characters as if they were the equivalent Unicode characters. This will be discussed at greater <br/>length in Chapter 3.
</div>

Upvotes: 0

Curtis
Curtis

Reputation: 103428

You should use <br/> elements in order to push content to a new line.

<break>
Another difference between the source files of C++ and the source files of Java is that Java source is written in Unicode,
<br/>a 16-bit international character set standard. If you create an ASCII source file, the Java compiler will treat the ASCII characters as if they were the equivalent Unicode characters. This will be discussed at greater length in Chapter 3.
</break>

Upvotes: 0

Related Questions