Pregunta

I'm making an image view thing, and am having some trouble with aligning the images. When I have two of the same image in a row, it will be aligned, but when the images are different, the second image will go lower than the first. Here is screenshot screenshot. Here is my html and css
html

<div id="wrapper">
        <div id="images">
            <div class="image" onClick="showimage('users/images/username/battlefield4_maars.png','battlefield4_maars.png','3.91MB','png');">
                <img src="users/images/username/battlefield4_maars.png">
                <div class="normaltext">battlefield4_maars.png</div>
            </div>
            <div class="image" onClick="showimage('users/images/username/dark_souls_2.jpg','dark_souls_2.jpg','363KB','jpg');">
                <img src="users/images/username/dark_souls_2.jpg">
                <div class="normaltext">dark_souls_2.jpg</div>
            </div>
            <div class="image" onClick="showimage('users/images/username/thief.jpg','thief.jpg','393KB','jpg');">
                <img src="users/images/username/thief.jpg">
                <div class="normaltext">thief.jpg</div>
            </div>
        </div>
    </div>

css

#images {
    margin-top: 20px;
    display: inline-block;
}
.image {
    height: 200px;
    width: 140px;
    border: 1px solid #cccccc;
    border-radius: 3px;
    background: #fff;
    display: inline-block;
    word-wrap:break-word;
    padding: 10px;
    cursor: pointer;
}
.image img {
    width: 140px;
    height: 140px;
}

Anyone know what's wrong here?

¿Fue útil?

Solución

add this:

#images {display:block;}
.image {
    vertical-align: top;
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top