Computers Can't Add?

Discussion in 'The Lounge' started by secretply, Jul 3, 2014.

  1. secretply

    secretply New Member

    I don't know if it's me missing something or computers really cannot add correctly. Apparently, the layout on my website is broken on certain circumstances. It is pretty weird since the code used for the layout that is broken is exactly the same as the code used in the layout for another page.

    The first attached file shows a correct layout. It even shows that the left side uses 57% of the width plus an extra 3% margin to the right. Then the right side uses 40% of the width. Therefore 57% + 3% + 40% = 100%.

    Now the second file...yeah there's some problems there. The console inspector shows the exact same styling done yet it thinks that 57% + 3% + 40% > 100% thus breaking the layout? I guess computers aren't the sharpest tool in the shed. (I should be missing something but I don't believe I am. This is not meant to be answered but just thought I'd share some dumbness of computers. lol)
     

    Attached Files:

  2. KH-Jonathan

    KH-Jonathan Director of Managed Services Staff Member

    Can you post the code that generates this in a code block, or better yet a link to this? I bet I can help ya find the problem ;)
     
  3. secretply

    secretply New Member

    The correct image is any HTML page on my website, which you can use the domain from the console inspector. The incorrect image is from a SHTML error page (404 in this case) but it is replicated in any 4xx or 5xx error code pages. Easiest way to get a 404 page is just type in a random directory except for test. Don't worry about trying to figure out the problem, it is not a huge concern to me.
     
  4. phpAddict

    phpAddict Active Member

    Dito to what Johnathan said. We have no way to view your code to help you. I'm interested to see a computer that cannot add.
     
  5. KH-Jonathan

    KH-Jonathan Director of Managed Services Staff Member

    @secretply we still need your URL to get to it so we can intentionally 404 it ;)
     
  6. secretply

    secretply New Member

    Well if you insist, the URL is https://www.secret-bux.com/ (clickable link here). You can put in a bogus directory or file like /39ch9skn.html or /bdu29s/ and it will return a 404 error. The code block is exactly the same as it is rendered when viewing any error page, no JavaScript or PHP or anything was done to make the rendered output code different from the actual code put in the error SHTML file.
     
  7. Dion

    Dion Member

    You're using display:inline-block, which makes the whitespace between the elements count towards the total width.

    You can fix the problem by removing the whitespace, or by using float:left or display:table-cell.
     
  8. KH-Jonathan

    KH-Jonathan Director of Managed Services Staff Member

    @Dion you beat me to it! :)
     
  9. secretply

    secretply New Member

    @Dion @KH-Jonathan Thanks for the help. I didn't believe there was a whitespace inbetween the elements. I found an article that talked about this and a solution was to use font-size: 0 on the parent element. Kind of a weird solution but makes sense.
     

Share This Page