Shouldn't a HTML document look pretty much the same in a browser window

I made a HTML document with a colored background, but the background shows up as white in a browser widow. WHY?

Works for me using LO 4.4.1.2 on Windows 8.

Using View Sourcein browser window gives :-


html

head

meta http-equiv=“content-type” content=“text/html; charset=windows-1252”/

title/title

meta name=“generator” content=“LibreOffice 4.4.1.2 (Windows)”/

meta name=“author” content=“x”/

meta name=“created” content=“2015-08-05T11:27:13.175000000”/

meta name=“changedby” content=“x”/

meta name=“changed” content=“2015-08-05T11:30:11.716000000”/

style type=“text/css”

@page { margin: 2cm }

p { margin-bottom: 0.25cm; line-height: 120% }

a:link { so-language: zxx }

/style

/head

body lang=“en-GB” bgcolor="#ff9999" dir=“ltr”

p style=“margin-bottom: 0cm; line-height: 100%”>

/p

/body

/html


The background colour is produced here :-



body lang=“en-GB” bgcolor="#ff9999" dir=“ltr”


Check what you get.

I cannot reproduce your problem; a writer page with a little text + back-colour looks identical for me in both writer & browser. Note that it is necessary to do a Save As... + choose Writer (HTML) to get the file as below.

Check what your Export options for html are:

(menu):Tools|Options...|Load/Save|HTML Compatibility

…Check then the value for Export. Options are:-

  • Microsoft Internet Explorer
    (this must be the option that peterwt used)
  • Firefox
    (better, but still not html5) (this is the option I used)
  • Writer
    (almost identical to ‘Firefox’)

Here is View Source in Firefox on that html page:-

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
	<title></title>
	<meta name="generator" content="LibreOffice 4.4.4.3 (Linux)"/>
	<meta name="author" content="Alex Kemp"/>
	<meta name="created" content="2015-08-05T17:23:01.557905907"/>
	<meta name="changedby" content="Alex Kemp"/>
	<meta name="changed" content="2015-08-05T17:39:29.821723289"/>
	<style type="text/css">
		@page { margin: 2cm }
		p { margin-bottom: 0.25cm; line-height: 120% }
		a:link { so-language: zxx }
	</style>
</head>
<body lang="en-GB" bgcolor="#ffff99" dir="ltr">
<p style="margin-bottom: 0cm; line-height: 100%">Some Text</p>
<p style="margin-bottom: 0cm; line-height: 100%"><br/>

</p>
</body>
</html>

If this helps then please tick the answer (:heavy_check_mark:).