Why is it that my CSS is not applied the same in all browsers? For example, for the below code:
<body align="center" background="F:\photos\sravan\wi7.jpg">
I can see my text which is aligned center and with background in Chrome, but not the same in Mozilla! Why is this happening?
Your code is not CSS
Instead you should have HTML and CSS as in:
and body CSS
Learn the languages
No offence but I warmly suggest you learn HTML and CSS before delving into writing any reasonable code.
HTML Specification
As per W3C specification
bodyelement doesn’t supportalignattribute andbackgroundis deprecated in 4.01 and not supported in HTML5. So don’t use it as an attribute. Define style using CSS:styleelement insideheadHTML element(not recommended) add style inline with your element:
Because of the way that CSS works having many inline styles makes your application hard to maintain and also intrduces new CSS hacks that you have to use in order for your page to render as expected. Separation of concerns rules. HTML file is your content definition, CSS file is its style. Keep them separate whenever possible.
General advice
Since browsers try to follow specification there may be differences between their rendering of HTML+CSS. Some may be very strict about it others a bit more loose. Try to stay within specification and you should get better cross-browser results.