Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Centered website, can change background
Old 08-21-2010, 09:08 PM Centered website, cannot change background
Moritz's Avatar
Average Talker

Posts: 24
Name: Daniel Moritz
Location: Sweden
Trades: 0
Okay, so basically. I'm a newbie to this.

My problems is, that i followed one of the link on this forum about centering my website horizontaly. I did it, and now i met some problems.

1. I can't change the white background around my website.

2. My right nav is a bit misplaced, and i can't fix it.


html code:
Code:
<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css">
<title>SA-MP Roleplay Guide >> Index</title>
</head>
<body>
<div id="body1">
    <div id="container">

        <div id="header">

        </div>



            <div id="horizontalnav">

                <div class="navlinks">
                
                <ul>
                <li><a href="http://www.website.com">Sleeping</a></li>
                <li><a href="http://www.website.com">Job</a></li>
                <li><a href="http://www.website.com">Friends</a></li>
                <li><a href="http://www.website.com">Toilet</a></li>
                
                </div>

            </div>




                    <div id="leftnav">Exempel av stock.</div>
                    
                    <div id="rightnav">Exempel av stock.</div>

            <div id="body"><div class="box"><div id="img"><img src="http://www.webmaster-talk.com/images/avatar.jpg" alt="" /></div><h2></h2> 
            
            </div>.</div>

        <div id="footer">Copyright Neverwind 2010</div>

    </div>
</div>


</body>
</html>

CSS Code


Code:
#container  {

    margin-left: auto;
    margin-right: auto;
    width: 56em;
    background-color:#000000;

    


}

#header    {

width: 900px;
height: 100px;
position: relative;
background-image:url("http://www.webmaster-talk.com/images/adback.png");
background-image: url(images/headerBG.jpg);
border-bottom: 2px solid #000000;

}

#header a  {

color: #ffffff;
text-decoration: underline;
font-weight: bold;
font-family: Verdana;
font-size: 14px;

}

#header a:visited  {

color: #000000;
text-decoration: underline;
font-weight: bold;

}

#header a:hover  {

color: #cc0000;
text-decoration: none;
font-weight: bold;

}


.HorizLinks  {

position: absolute; top: 77px; left: 180px; 

}

.HorizLinks ul { 

margin: 0px; 

}

.HorizLinks li {

margin: 0px 15px 0px 0px;
list-style-type: none;
display: inline;
    
}


#horizontalnav  {

width: 900px;
height: 30px;
position: relative;
background-color: #000000;
border-bottom: 2px solid #000000;

}

.navlinks  {

position: absolute; top: 4px; left: 140px; 

}

.navlinks ul { 

margin: auto;

}

.navlinks li {

margin: 0px 18px 0px 0px;
list-style-type: none;
display: inline;
    
}

.navlinks li a {

color: #ffffff;
padding: 5px 12px 7px;
text-decoration: none;
font-size: 16px;
font-family: Verdana;

}

.navlinks li a:hover{

color: #ffffff;
background-color: #c0c0c0;
 /*If you want to use a color for the background instead replace above line with background-color: [insert color here with # sign in front];*/
text-decoration: underline;


}


#header p  {

color: #000000;
font-family: Arial;
font-weight: bold;

}

.smalltext   {

font-size: 9px;
font-family: Arial;

}


#leftnav {

float: left;
width: 140px;
height: 506px;
background-image:url("http://www.webmaster-talk.com/images/navbar.jpg");
border-right: 1px #694717;

}
        

#rightnav  {

float: right;
width: 140px;
height: 506px;
background-image:url("http://www.webmaster-talk.com/images/navbar.jpg");
border-left: 1px #694717;

}

#body  {

margin: auto;
width: 600px;
padding: 10px 0px 0px 10px;
background-color:#000000;


}

#footer  {

clear: both;
background-image:url("http://www.webmaster-talk.com/images/footer.jpg");


}

.box  {

margin-top: 10px;
padding: 5px 5px 5px 5px;
background-color: #dddddd;
border: 2px solid #d22929;
width: 350px;
color: #000000;

}

h2  {

font-size: 20px;
color: #cc0000;
padding: 10px;
font-family: Verdana;

}
Pic of my site:

Last edited by Moritz; 08-22-2010 at 05:55 AM..
Moritz is offline
Reply With Quote
View Public Profile Visit Moritz's homepage!
 
 
Register now for full access!
Old 08-22-2010, 12:42 PM Re: Centered website, can change background
Novice Talker

Posts: 10
Location: Pakistan
Trades: 0
For your first problem, I'd suggest adding this code:

Code:
body {
background: #000;
}
Depends on you if you want to use an image or a color.
AadilP is offline
Reply With Quote
View Public Profile Visit AadilP's homepage!
 
Old 08-22-2010, 03:25 PM Re: Centered website, can change background
shivaji's Avatar
Ultra Talker

Posts: 321
Trades: 0
Code:
This is for margin around body
body {
background: #000000;
margin: 0;
padding: 0;
}
If you are centered your site why then you need to put menu on left. Of course this is possible but....

You are define body1 but you haven't css definition for them.
__________________

Please login or register to view this content. Registration is FREE
- uncommon free scripts

Please login or register to view this content. Registration is FREE
- Städte, Sport, Party, Gourment, Apartments, Hotels
shivaji is offline
Reply With Quote
View Public Profile Visit shivaji's homepage!
 
Old 08-30-2010, 09:07 AM Re: Centered website, can change background
.master's Avatar
Novice Talker

Posts: 3
Name: Binji P
Trades: 0
Total width of the site is 900px.
width of leftnav is 141px
width of leftnav is 141px
width of body is 600px
total 141+141+600 = 882 not equal to 900

Make the body width 618

still problem,
Please add the working url of the page.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
.master is offline
Reply With Quote
View Public Profile Visit .master's homepage!
 
Reply     « Reply to Centered website, can change background
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.64287 seconds with 12 queries