/    Sign up×
Community /Pin to ProfileBookmark

Problem centering

I am Trying to build a new homepage and I cant work out why the header won’t center, [url=http://thttest.110mb.com/]This[/url] is the page and the code is below; can anyone help? thanks

[code]<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html>
<head>
<title>South west THT Young Leaders</title>
<link rel=”stylesheet” type=”text/css” href=”/layout.css” />
</head>
<body>
<div id=”page-wrap”>
<ul id=”nav”>
<li></li>
</ul>
</div> <!– END page-wrap–>
</body>
</html>[/code]

[code]body
{
background:url(‘images/header.jpg’) repeat-x top;
background-color: #ffffcc
}

div.page-wrap {
margin: 0 auto;
}

ul#nav {
height: 200px; width: 900px;
background: url(‘/images/banner_ctr.gif’) no-repeat;
margin: -8px;
list-style-type: none;
}
[/code]

to post a comment
CSS

7 Comments(s)

Copy linkTweet thisAlerts:
@felgallNov 01.2008 — div.page-wrap

should be

div#page-wrap
Copy linkTweet thisAlerts:
@matt25authorNov 01.2008 — I have changed that and it still isn't centering ?
Copy linkTweet thisAlerts:
@felgallNov 01.2008 — Since you haven't specified a width for page-wrap it is defaulting to 100&#37; and is centering in that - ie. the margins that auto places on each side are zero.
Copy linkTweet thisAlerts:
@matt25authorNov 01.2008 — Ah ok, I get it, I have specified the width and it works! thanks.
Copy linkTweet thisAlerts:
@matt25authorNov 02.2008 — I know have another problem, I can't get the links to show; this is my latest code.

[CODE]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>South west THT Young Leaders</title>
<link rel="stylesheet" type="text/css" href="/layout.css" />
</head>
<body>
<div id="page-wrap">
<ul id="nav">
<li id="home"><a href="#">Home</a></li>
<li id="forum"><a href="#">Forum</a></li>
<li id="contact"><a href="#">Contact</a></li>
</ul>
</div> <!-- END page-wrap-->
</body>
</html>[/CODE]

[CODE]
body
{
background:url('images/header.jpg') repeat-x top;
background-color: #ffffcc
}

div#page-wrap {
margin: 0 auto;
width: 920px;
}

ul#nav {
height: 200px; width: 900px;
background: url('/images/banner_ctr.gif') no-repeat;
margin: -8px;
list-style-type: none;
}
ul#nav li {
display: inline;
}
ul#nav li a {
display: block;
height: 98px;
float: left;
text-indent: -9999px;
}
ul#nav li.home a {
width: 319px;
background: url(images/nav_home.jpg) bottom center no-repeat;
}
ul#nav li.forum a {
width: 286px;
background: url(images/nav_forum.jpg) bottom center no-repeat;
}
ul#nav li.contact a {
width: 315px;
background: url(images/nav_contact.jpg) bottom center no-repeat;
}[/CODE]
Copy linkTweet thisAlerts:
@FangNov 02.2008 — The links are off screen: [I]text-indent: -9999px;[/I]
Copy linkTweet thisAlerts:
@matt25authorNov 02.2008 — Yeah, I want the text to be off screen and the images to be the links.
×

Success!

Help @matt25 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...