Centered in Chrome – Is on the left in Firefox

I’ve been designing my site re-learning CSS after taking a long time, and have been essentially creating a website (integrated with WordPress) by basically doing as little as possible with the HTML/PHP, and trying to design it all from the CSS and available CLASS and IDs setup for me by a template theme. (Blankslate Theme)

This entire time it’s been coming along fine in Chrome. I decided before I got too far to check it out on Firefox. Firefox decides everything should be squished to the LEFT, while in Chrome the site looks perfectly centered and matches things I try to do in the CSS.

Read More

I tried to align both the WRAPPER, Body, and even HTML to center the entire page, but Firefox refuses to do so. My fixed sidebar on the right is suppose to be spaced away from the main content, which it is in Chrome (unless you increase the size of the entire page, then it overlaps.) In Firefox, it doesn’t even try to go as far right as possible, it just squishes in with everything else.

I’ve also wanted to use Ellipsis to cut off the text in the Sidebar if it’s too long, however it refuses to work. It either cuts the text off, but does not substitute ellipsis, or runs off the page.

Below is the structure I’d like:

http://www.icesage.com/i/site2.png

Here is the CSS I’m using. As for the PHP/HTML structure you’ll need to go to the actual website itself as there are too many to show here. (Again, it’s WordPress, and uses the theme Blankslate as a starting point.)

body {
background-color: black;
background-repeat:no-repeat; 
background-attachment:fixed; 
background-size: 110%;
line-height: 20px;
text-size: 10px;
font-family: Verdana;
}


#site-title {
    position:relative;
    top:0px;
    margin: 0 auto;
    width: 10%;
    display:none;
}

/* #header {
    position:relative;
    top:0px;
    margin: 0 auto;
    width: 40%;
} */

#footer {
    position: relative;
    float: right;
    bottom: 0;
    margin: 2% auto;
    right: 25%;
    width: 50%;
    height: 10px;   /* Height of the footer */
    background-color:rgba(0,0,0,0.7); 
border-radius: 10px; 
box-shadow: 5px 0px 4px 0px #1c6191; 
    color: white;
    text-align: center:
    padding-top: 5px;
    padding-bottom: 9px;
    padding-right: 5px;
    padding-left: 5px;
    display: inline
}

#copyright {
text-align: center;
}

/* Top Navigation */

#menu {
margin: 0 auto;
}

#menu a {
    float: left;
    color: white;
    display: block;
    height: 40px;
    line-height: 40px;
    text-decoration: none;
    text-align: center;
    margin-right: 10px;
    border-left-style: solid;
    border-width: 1px;
    border-color: #1c6191;
    background-color:rgba(0,0,0,0.9); 
    border-radius: 10px; 
    box-shadow: 4px 0px 2px 3px #1c6191; 
    padding-top: 0px;
    padding-bottom: 0px;
    padding-right: 15px;
    padding-left: 15px;

}



#menu a:hover {

    background-color: blue;

}

.entry-title {
font-size: large;
width:60%;
text-shadow: 2px 0.5px #1c6191;
background-color:rgba(0,0,0,0.7); 
border-radius: 20px; 
box-shadow: 5px 0px 4px 0px #1c6191; 
color: white;
padding-top: 5px;
padding-bottom: 5px;
padding-right: 5px;
padding-left: 5px;
margin: 2px
}

/* h1 .entry-title {
display: none;
font-size: 50px;
}

h2 .entry-title {
display:none;
font-size: 50px;
}

h3 .entry-title {
font-size: 50px;
text-shadow: 2px 0.5px #1c6191;
}

h3 .widget-title {
font-size: 50px;
text-shadow: 2px 0.5px #1c6191;
}
*/

.cat-links {
display:none;
}


/* Main Content Post (Entry) */

.post {
width: 70%; 
background-color:rgba(0,0,0,0.9); 
border-radius: 20px; 
box-shadow: 5px 0px 4px 0px #1c6191; 
color: white;
padding-top: 25px;
padding-bottom: 25px;
padding-right: 50px;
padding-left: 50px;
margin: 30px;
margin-left: 5px;
}

img.alignright {float:right; margin:20px 10 10em 10em; background-color: royalblue; border: 1px;}
img.alignleft {float:left; margin:20px 10em 2em 2em;}
img.aligncenter {display: block; margin-left: auto; margin-right: auto}

.alignright {float:right; text-align:center; padding-left: 20px;}
.alignleft {float:left; }
.aligncenter {display: block; margin-left: auto; margin-right: auto}

.wp-caption-text {
font-size: small;
font-style:italic;
text-align:center;
}


.post-edit-link  {
    float: left;
    color: white;
    position: relative;
    display: block;
    height: 40px;
    line-height: 40px;
    text-decoration: none;
    text-align: center;
    margin-right: 10px;
    border-left-style: solid;
    border-width: 1px;
    border-color: #1c6191;
    background-color:rgba(0,0,0,0.9); 
    border-radius: 10px; 
    box-shadow: 4px 0px 2px 3px #1c6191; 
    padding-top: 0px;
    padding-bottom: 0px;
    padding-right: 15px;
    padding-left: 15px;
    }

.post-edit-link:hover {
    background-color: blue;
}

.comments-link  {
    float: right;
    color: white;
    display: block;
    position: relative;
    height: 40px;
    line-height: 40px;
    text-decoration: none;
    text-align: center;
    margin-right: 10px;
    border-left-style: solid;
    border-width: 1px;
    border-color: #1c6191;
    background-color:rgba(0,0,0,0.9); 
    border-radius: 10px; 
    box-shadow: 4px 0px 2px 3px #1c6191; 
    padding-top: 0px;
    padding-bottom: 0px;
    padding-right: 15px;
    padding-left: 15px;
    }

.comments-link:hover {
    background-color: blue;
}

.type-page {
width: 70%; 
float: left;
background-color:rgba(0,0,0,0.9); 
border-radius: 20px; 
box-shadow: 5px 0px 4px 0px #1c6191; 
color: white;
padding-top: 25px;
padding-bottom: 25px;
padding-right: 50px;
padding-left: 50px;
margin: 40px
overflow: auto;
}

.nav-previous {
display: none;
}

.comments {
width: 70%; 
float: left;
background-color:rgba(0,0,0,0.9); 
border-radius: 20px; 
box-shadow: 5px 0px 4px 0px #1c6191; 
color: white;
padding-top: 25px;
padding-bottom: 25px;
padding-right: 50px;
padding-left: 50px;
margin: 20px
}

.comment {
width: 70%; 
float: left;
background-color:rgba(0,0,0,0.9); 
border-radius: 20px; 
box-shadow: 5px 0px 4px 0px #1c6191; 
color: white;
padding-top: 25px;
padding-bottom: 25px;
padding-right: 50px;
padding-left: 50px;
margin: 20px
}

#header {
width: 60%; 
margin: 0 auto;
background-color:rgba(0,0,0,0.7); 
border-radius: 20px; 
box-shadow: 5px 0px 4px 0px #1c6191; 
color: white;
padding-top: 25px;
padding-bottom: 25px;
padding-right: 50px;
padding-left: 50px;
margin-bottom: 40px;
}

#titlebanner {
margin: 0 auto;
}

.meta-sep {
display: none;
}

html {
zoom: .8; 
-moz-transform: scale(0.8); 
-moz-transform-origin: 0 0;
margin: 20px auto;
}

.comment-respond {
color: white;
width: 60%; 
float: left;
background-color:rgba(0,0,0,0.7); 
border-radius: 20px; 
margin: 0 auto; 
box-shadow: 5px 0px 4px 0px #1c6191; 
font-color: white;
padding-top: 25px;
padding-bottom: 25px;
padding-right: 50px;
padding-left: 50px;
}

.entry-date {
color: royalblue;
}

#wrapper {
-moz-margin-start: -40px auto;
margin-right: 0 auto;
}


/* Sidebar */

.widget-area {
    position: fixed;
    top: 225px;
    z-index: 1;
    right: 0.5%;
    text-shadow: 2px 2px #1c6191;
    width: 300px; 
    float:left;
    border-left-style: solid;
    border-width: 1px;
    border-color: #1c6191;
    background-color:rgba(0,0,0,0.9); 
    border-radius: 10px; 
    box-shadow: 4px 0px 2px 3px #1c6191; 
    color: white;
    padding-top: 0px;
    padding-bottom: 0px;
    padding-right: 0px;
    padding-left: 0px;
    margin-right: inherit;
}



.xoxo {
display:block;
padding-top: 2px;
padding-bottom: 2px;
padding-right: 2px;
padding-left: 2px;
white-space: nowrap;
overflow: hidden;
text-overflow: clip
text-overflow: ellipsis
text-overflow: "…"

}



#searchsubmit {
display:none;
}


.searchform  .screen-reader-text {
   display:none;
}

.xoxo .screen-reader-text {
   display:none;
}

.entry-content {
width: 90%;
color: white;
padding-top: 25px;
padding-bottom: 25px;
padding-right: 25px;
padding-left: 25px;
text-align:justify;
/* text-shadow: 2px 0.5px #1c6191; */
}

P {
color: white;
}

#search {
display:none
}

#site-description {
display:none
}

A {
text-decoration: none;
font-family:Verdana; 
}

A:link {
text-decoration: none;
color:#04CCFD; 
font-family:Verdana;
}

A:visited {
text-decoration: none; 
color:#04CCFD;
font-family:Verdana;
}

A:active {text-decoration: none; 
color:#04CCFD; 

}

A:hover {
text-decoration: none; 
color:white; 
} 

li .widget-container {
font-color: white;
}

/* Sub-Menu Test */



/* End Sub-Menu Test */

video{font-size:100%;font:inherit;padding:0;border:0;margin:0;vertical-align:baseline}
ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}

table{border-collapse:collapse;border-spacing:0}
section{display:block}
.clear{clear:both}
.sticky{}
.bypostauthor{}
.wp-caption{}
.wp-caption-text{}
.gallery-caption{}
.alignright{}
.alignleft{}
.aligncenter{}

Website: http://www.icesage.com
Or you can take a look at “Blankslate.”

Any help in figuring out what I’m doing wrong or pointing out some sloppy code would be appreciated, but the main question for this post is:

How can I contain everything in the wrapper properly and have the entire site centered, including the sidebar, in all browsers (especially Firefox) like how it appears in Chrome? (Additionally, some of the layout was done accidentally, like the Comment & TopNav buttons appearing slightly off the previous area. Which I want to keep, but I’m not sure how to properly keep it that way.)

I searched thoroughly and the answers provided keep telling me the appropriate CSS to use, and I keep using it to no avail. Other questions are simply left unanswered.

Any help would be appreciated!

Related posts

Leave a Reply

2 comments

  1. The problem is coming from the way you used transform-origin for firefox browser. Look at the following class

     html {
     zoom: .8; 
     -moz-transform: scale(0.8); 
     -moz-transform-origin: 0 0;
      margin: 20px auto;
      }
    

    As you mentioned “0 0” for origin property. The first value is the horizontal position, the second value is the vertical. So it aligned to left and top position. If you want horizontally center the page then you need to give “center, top” or “50%,0”. Update your CSS like below.

     html {
     zoom: .8; 
     -moz-transform: scale(0.8); 
     -moz-transform-origin:50% 0;
      margin: 20px auto;
      }
    

    Additional Question asked by OP in the comment box:
    do you know why the sidebar is still condensed and overlapping the content on the left, when it doesn’t do that in Chrome?

    This issue came because the default behavior of chrome and firefox. Look at the following class.

      .post {
       width: 70%; 
       background-color:rgba(0,0,0,0.9); 
       border-radius: 20px; 
       box-shadow: 5px 0px 4px 0px #1c6191; 
       color: white;
       padding-top: 25px;
       padding-bottom: 25px;
       padding-right: 50px;
       padding-left: 50px;
       margin: 30px;
       margin-left: 5px;
      }
    

    The default chrome property for box-sizing:border-box and firefox is box-sizing:content-box. This is causing the problem. Check what is the difference between these to here

    So force firefox to use border-box property for box-sizing. Update the CSS like below.

       .post {
       width: 70%; 
       background-color:rgba(0,0,0,0.9); 
       border-radius: 20px; 
       box-shadow: 5px 0px 4px 0px #1c6191; 
       color: white;
       padding-top: 25px;
       padding-bottom: 25px;
       padding-right: 50px;
       padding-left: 50px;
       margin: 30px;
       margin-left: 5px;
       -moz-box-sizing:border-box;
      }
    
  2. The site looks in Chrome exactly as it looks in Firefox. Because of this here:

    margin-right: 0 auto;
    

    which is an invalid property for margin-right. You want

    margin: 0 auto;