Forums

how to make top margin flush with the top of the window? (7 posts)

  1. krez
    Member
    Posted 5 years ago #

    Hi all,

    I'm looking to make the top of the content of my whole site line up flush with the top of the browser window. So there is no space in between. Anyone know how to do this?

    if the answer involves editing the CSS stylesheet, please be as specific as possible about where / which code to edit. thanks!

    -ben

  2. Adam Brown
    Member
    Posted 5 years ago #

    Link?

  3. krez
    Member
    Posted 5 years ago #

    http://www.metalsucks.net

    As you can see there's a gap, maybe 50 pixels or so, between the site and the top of the window.

  4. Adam Brown
    Member
    Posted 5 years ago #

    In your theme's style.css file, look for this:

    /* Begin Structure */
    body {
    	margin: 0 0 20px 0;
    	padding: 0;
    	}
    
    #page {
    	background-color: white;
    	margin: 20px auto;
    	padding: 0;
    	width: 760px;
    	border: 0px solid #959596;
    	}

    In the #page section, change this
    margin: 20px auto;
    to this
    margin: 0px auto 20px;

    After uploading your style.css, hold down shift while clicking reload to flush the cache.

  5. krez
    Member
    Posted 5 years ago #

    You, sir, are brilliant. Thank you very much. Now for the obvious follow up question -- how to make the bottom margin flush with the bottom of the window? I tried the next logical step of making the code above as follows:

    margin: 0px auto 0px;

    That didn't do the trick. Any suggestions?

  6. Adam Brown
    Member
    Posted 5 years ago #

    You were halfway there with your intuition. (Actually, you can just delete the second "0px" part.)

    Write above where you changed it the first time, in the body section, change this:
    margin: 0 0 20px 0;
    to this:
    margin: 0;

    Voila!

  7. krez
    Member
    Posted 5 years ago #

    Very nice. Thank you kindly.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags