The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS 50% plus 50% equals 105%?

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #33968

    hey gang:

    here’s the relevant HTML and CSS first:


    Bad CSS Math

    like a fat kid on a cupcake

    Copyright © 2011 MoDUS


    body {
    background: url(../_img/body_bg.gif);
    color: #ccffff;
    line-height: 1.0em;
    font-style: normal;
    font-weight: normal;

    article, aside, figure, footer, header, nav, section {
    display: block;

    footer {
    margin: 0 auto 20px;
    min-height: 120px;
    width: 930px;

    #quote {
    font-family: "HeroidRegular", Tahoma, Geneva, sans-serif;
    padding: 10px;
    width: 50%;
    float: left;

    #copy {
    padding: 10px;
    text-align: right;
    width: 50%;
    float: right;

    for some reason i cannot determine, this produces this lovely effect:

    what the heck is happening!? i checked margins, padding, &c and nothing appears to be out of order. when i hover the mouse over the design side, the popups are accurate!! i am totally stumped.



    The padding on your quote and copy divs will cause this.



    30px Width + 20px Padding = 70px Actual Width
    50% Width + 10px Padding = 50%+20px Actual Width


    yeah. dammit. i thought the percentage automatically compensated. i guess not. thanks guys. i will now go bash my buddy’s head with a Nerf brick…



    @WhiteRau @TheDoc you could actually use the CSS box-sizing property to force the padding inside the box rather than outside. It will work in all browsers other than IE7 (see: You would use the following code:

    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;

    See here for more details:

    I have also done up a quick fiddle to help illustrate:

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.