Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default probably simple CSS help

    hey all, i have two questions about css for you

    before i explain my first problem please take a look at this image:
    http://imgur.com/wk7l5.png (open it in a new window, it's a big image)
    as you can see, i have a left side bar and a blue box in the middle. the blue box is centered for the whole width of the page, but i want it from the right side of the side bar to the far right side of the page.

    my second question (refer to the link i posted above) is that i have a margin 20px on the blue box, but it also adds a margin to the sidebar, why is that?

    here is my code:

    html:
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>easyPanel - the most simplistic ******* dj panel you will ever know.</title>
    
    <link type="text/css" rel="stylesheet" href="style.css" />
    </head>
    
    <body>
    
    <div id="sidebar">
    
    <div id="logo"></div>
    
    <div class="navSelections">dashboard</div>
    <div class="navSelections">timetable</div>
    <div class="navSelections">requests/shoutouts</div>
    <div class="navSelections">dj communicator</div>
    <div class="navSelections">dj options</div>
    <div class="navSelections">account optins</div>
    
    <div id="djStats">
    here are some quick stats!<br />
    5 listeners<br />
    7 unread shoutouts/requests<br />
    current song: wonderwall / welcome to the club<br />
    this is how the dj says box appears on sitename:<br />
    <img src="images/djSaysBox.png" />
    </div>
    
    </div>
    
    <div id="welcomeBox">Welcome to easy panel, DJ Will. You last logged in on: Friday, July 20th 2010.<br />
    According to the timetable, your next show is in 37 minutes, after DJ Powers.</div>
    
    </body>
    </html>
    css:
    Code:
    @charset "utf-8";
    /* CSS Document */
    
    html {
    	height: 100%;
    }
    
    body {
    	background-color: #f7f7f7;
    	margin: 0;
    	font-family: Verdana, Geneva, sans-serif;
    	height: 100%;
    	font-size: 12px;
    }
    
    #sidebar {
    	float: left;
    	background-image: url(images/sidebar.png);
    	width: 307px;
    	height: 100%;
    	position: fixed;
    }
    
    #logo {
    	background-image: url(images/logo.png);
    	width: 305px;
    	height: 174px;
    }
    
    .navSelections {
    	background-color: #808080;
    	width: 285px;;
    	height: 15px;
    	color: #FFF;
    	text-align: right;
    	padding-right: 20px;
    	margin-bottom: 20px;
    }
    
    .navSelections:hover {
    	background-image: url(images/navHover.png);
    	background-position: right;
    	background-repeat: no-repeat;
    	padding-left: 2px;
    }
    
    #djStats {
    	width: 285px;
    	padding: 10px;
    	color: #FFF;
    	bottom: 0;
    	position: absolute;
    }
    
    #welcomeBox {
    	width: 800px;
    	background-color: #61caf5;
    	border: 1px solid #2486af;
    	margin: 20px auto;
    	color: #FFF;
    	padding: 10px;
    }
    thanks!

  2. #2
    Join Date
    Aug 2010
    Posts
    14
    Tokens
    0

    Default

    shouldn't the margin: 20px auto; be margin-left: 20px auto; ?

  3. #3
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    i don't want there to be a margin on the left, as i want it to be centered. but that's my problem, it's centered in the middle of the whole page, i don't want that.

  4. #4
    Join Date
    Aug 2009
    Posts
    78
    Tokens
    100

    Latest Awards:

    Default

    The attribute margin: 20px is applying a 20 pixel margin all the way around the image. It's the equivalent of:
    Code:
    margin-top: 20px;
    margin-right: 20px;
    margin-bottom: 20px;
    margin-left: 20px;
    I would strongly recommend that you use a Reset CSS file which removes browser-specific styling of elements and you will find your CSS easier to code.

    P.S: I hope that:
    HTML Code:
    <div class="navSelections">dashboard</div>
    <div class="navSelections">timetable</div>
    <div class="navSelections">requests/shoutouts</div>
    <div class="navSelections">dj communicator</div>
    <div class="navSelections">dj options</div>
    <div class="navSelections">account optins</div>
    Is a bunch of separate navigation menus...

    Navigations should be done using unordered lists.

  5. #5
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    yes i know what the margin attribute does.
    but what you have posted still has nothing to do with what i posted.

  6. #6
    Join Date
    Aug 2009
    Posts
    78
    Tokens
    100

    Latest Awards:

    Default

    As I said, use a CSS reset file and you will be able to style your elements better.

  7. #7
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    i am, but i still don't know how i would remove the margin from the sidebar and center the blue box with what's left of the white area.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •