Aakansha
Aakansha

Reputation: 559

<br /> is read as <br></br> in firefox but not in chrome

I am using <br /> and its working correctly in chrome and IE as expected but in firefox the result is weird. When i saw the code in firefox, its replacing the <br /> with <br ></br>.

I also read somewhere that the alternative syntax <br></br> allowed by XML gives uncertain results in many existing user agents.

If I replace <br /> with <br>, its works fine in chrome and IE but firefox again replaces it with <br ></br> and gives extra margin.

what's the fix for this problem in firefox?

Upvotes: 3

Views: 921

Answers (1)

JAB
JAB

Reputation: 21089

Putting

<html>
    <body>
        <div>This is<br />a test</div>
    </body>
</html>

in a text file with the "html" extension, opening the file in Firefox, and checking the source view showed <br /> as expected. Firefox only shows <br ></br> when using the Inspector view, as far as I can tell, which is likely a result of standardizing how tags are displayed in that view as using <br> instead of <br /> also produces <br ></br> in it.

Upvotes: 1

Related Questions