Alexandre
Alexandre

Reputation: 5135

Align the tops of block elements

My HTML5/CSS is being rendered as follows: https://i.sstatic.net/2KouR.jpg

Using the following code:

                <li>
                    <div class="name">Booger Jet.zip</div>
                    <progress max="100" value="60"></progress>
                    <div class="control"></div>
                    <div class="status">12 MB / 21 MB   240 kB/s</status>
                </li>

#uploads li progress {
    width: 317px;
    margin-bottom: 4px;
}

#uploads li .control {
    width: 14px;
    height: 14px;
    display: inline-block;
    opacity: 0.6;
    background-image: url('../img/stop_button.png');
}

How do I vertically align them? What are my options? Thank you!

Upvotes: 0

Views: 66

Answers (2)

Daniel Ezra
Daniel Ezra

Reputation: 1444

try it

#uploads li progress {
    width: 317px;
    margin-bottom: 4px;
    margin-top:1px; /* change it if you need more top sapce*/
}
#uploads li .control {
        width: 14px;
        height: 14px;
        display: inline-block;
        vertical-align:top;
        opacity: 0.6;
        background-image: url('../img/stop_button.png');
    }

Upvotes: 1

sandeep
sandeep

Reputation: 92793

You can use vertical-align:middle for this.

#uploads li .control, #uploads li progress{
 display:inline-block;
 vertical-align:middle;
}

Upvotes: 0

Related Questions