Search code examples
htmlcssimagewebjsfiddle

JSFiddle - Website blank hidden space


I'm currently trying to make a new design for my website. I got to this point, but I cannot find out how to remove the blank space to the right of the picture (slide the webpage to the right and you see it, a huge blank space).

Here is the JSFiddle: https://jsfiddle.net/yscu95hb/1/

And here is part of the code that I think I have to change.

#conteudo {
    top: 15px;
    position: absolute;
    margin: 0px 15px 0px 260px;
}

.images {
    margin: auto;
    position: relative;
    width: calc(100vw - 260px);
    align-content: center;
}

.images img {
    max-height: calc(100vh - 35px);
    max-width: 100%;
    position: absolute;
    z-index: 990;
}

Can anyone help me? Thank you.

-- edit --

I already posted the code that shows the image but I cannot make it to center. Any suggestions?


Solution

  • the reason you see the "white" space on the right side is the css you are applying to your #conteudo element.

    This is your css for the element:

    #conteudo {
        top: 15px;
        position: absolute;
        margin: 0px 15px 0px 260px;
        width: 100vw;
    }
    

    there are multiple ways to fix this. one way would be to remove the margin attribute or change the width to something lower than 100vw. What you are doing is saying the element should be as wide as the browser window (100% of the window width) and then also saying that outside that width it should have more margin (in your case 15px on the right and 260px on the left), and that is "streching the page", causing the total widht to be larger than window width.