Jump to content

why doesn't it show same in different browsers?


mpsn

Recommended Posts

Hi, I included a doctype, but now I noticed on chrome and ff, the background.png is different, I want the backgrond.png fill up the almost to the bottom, leaving just enough for copyright, which it not displaying below the background.png inside the mainBox element.

 

I don't want any fancy shortcuts or tricks as I am new to CSS and I just built what I have so far with just w3schools.com.

 

Here is css:

#mainBox
{
position:relative;
top: 0px;
margin-left: auto;
margin-right: auto;
border: 1px solid;
width:300px;
height:400px;
}

p.logo
{
position:absolute;
top: 0px;
padding: 0px 15px 30px 15px;
}

#logoBox
{
position: absolute;
top: 10px;
margin-left:auto;
margin-right:auto;
width:100%;
border: 0px solid;
background-color: #F60;
}

#backgroundBox
{
position:absolute;
top:110px;
margin-left:auto;
margin-right:auto;
padding: 0px 0px 20px 0px;
}

#footer
{
position:absolute;
top: 330px;
padding: 5px 5px 5px 5px;
border: 2px solid;
width: 90%;


}

 

here is html:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title>CSS trial</title>
	<link rel="stylesheet" type="text/css" href="css.css" />
</head>

<body>
	<div id='mainBox'>
		<div id='logoBox'>
			<p id="logo">
			<img src='logo_.gif' style="height:20%; width:25%;"/>
			</p>	
		</div>
		<div id='backgroundBox'>

			<img src='TreeBackground.png' style='height:65%; width:100%;' />

		</div>
		<div id='footer'>
			<p>©2011</p>
		</div>
	</div>
</body>
</html>

 

I attached the logo and TreeBackgorund.png, any help appreciated.

post-117347-13482403127537_thumb.gif

post-117347-13482403127916_thumb.png

Sorry, more specifically, I mean when I zoom in and out with chrome, the background moves whereas in FF, it doesn't. I noticed IE is ok too, and not Safari (since both chrome and Safari run off webkit engine).

 

Please i'd appreciate any help!

Please feel free to ask if what I am asking is confusing or not completely understandable. I am new to using CSS and I find the absolute/relative positioning hardest for some reason. I understand tha relative position is used as a container for absolute position (as indicated on w3schools.com). Again, any web designers could help a fellow out be the best!

Hi,

 

Position isn't actually needed with what you are trying to do.

 

Take a step back, remove all the positions and see how it looks, then rather then apply positions, see if you can achieve what you want by adding different values.

 

For example, set the image to display:block; add a margin and then see how it looks.

 

I don't fully understand what you are trying to achieve but positions are one of those things that should only really be used when you really need to, which is very little in most cases!

 

Good luck

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.