iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Graphics & Design Discussion Forum Post your graphics design questions/comments/ideas in here. Ask questions, post tutorials, discuss trends and best practices. Sub-forum for website accessibility and usability.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-30-2006, 01:15 AM
WebProWorld New Member
 
Join Date: May 2004
Location: Australia
Posts: 15
Clint Neilsen RepRank 0
Default css centered fixed layout background image

Hello Guys,

In CSS I am having trouble centering a fixed multi column layout with the a frame container having a repeating background image.

The below code make IE5 center but I cannot center in mozilla.

BODY {
background-color : yellow;
margin: 0 auto;
text-align: center; /*makes IE5 play nice*/
}

Any Ideas would be appreciated
__________________
No trees were harmed in the making or sending of this message.
However a great number of electrons were terribly inconvenienced!
Reply With Quote
  #2 (permalink)  
Old 04-30-2006, 01:29 AM
Easywebdev's Avatar
WebProWorld Veteran
 
Join Date: Apr 2004
Posts: 310
Easywebdev RepRank 1
Default

The body tag has a default width of 100% so margin auto = 0px.

You need to specify a width for an overall page container that wraps all content.

div #wrapper {
width: 80%;
}

<body>
<div id="wrapper">
Your content
</div>
</body>

Then margin: 0 auto; will have a left and right margin of 10%.

Hth.
Reply With Quote
  #3 (permalink)  
Old 04-30-2006, 03:26 AM
WebProWorld New Member
 
Join Date: May 2004
Location: Australia
Posts: 15
Clint Neilsen RepRank 0
Default Full Code

Cheers Easywebdev,

Gave it a go but the problem rmains unsolved. Here's the full code (shoulda posted it first)

<head>
<title>Three-column Layout</title>
<style type="text/css">
BODY {
background-color : yellow;
margin: 0 auto;
text-align: center; /*makes IE5 play nice*/
}
#content {
background-color: yellow;
padding: 0px;
position: relative;
width:760px;
height: 600px;
margin-right: auto;
margin-left: auto;
text-align: center;
margin: 0px 0px 0px 15px;
}
#left {
background-color: green;
padding: 00px;
text-align: left;
width: 253.00px;
position: absolute;
left: 0px;
top: 150px;
}
#middle {
background-color: yellow;
padding: 0px;
text-align: left;
width: 253.00px;
position: absolute;
left: 253px;
top: 150px;
}
#right {
background-color: silver;
padding: 00px;
text-align: right;
width: 253.00px;
position: absolute;
right: 0px;
top: 150px;
}
H1 {
background-image: url(images/back.gif);
background-repeat: repeat-y;
margin-top: 0px;
height: 600px;
}
H1 span {
display:none;
}
</style>
</head>
<body>
<div id="content">
<H1><span>

</span></H1>
[img]images/test_logo.gif[/img]
keywords

<div id="left">
hello
</div>
<div id="middle">
wow
</div>
<div id="right">
hello
</div>
</div>
</body>
__________________
No trees were harmed in the making or sending of this message.
However a great number of electrons were terribly inconvenienced!
Reply With Quote
  #4 (permalink)  
Old 04-30-2006, 02:20 PM
Easywebdev's Avatar
WebProWorld Veteran
 
Join Date: Apr 2004
Posts: 310
Easywebdev RepRank 1
Default

You are overriding your left-right margin assignments.

#content {
background-color: yellow;
padding: 0px;
position: relative;
width:760px;
height: 600px;
margin-right: auto; <- set here
margin-left: auto; <- set here
text-align: center;
margin: 0px 0px 0px 15px; <- overriden and set again here
}
Reply With Quote
Reply

  WebProWorld > Site Design > Graphics & Design Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 10:12 AM.



Search Engine Optimization by vBSEO 3.3.0