简体   繁体   中英

Is there any way to make these span elements vertically align?

I'm using a JQuery Sortable control with spans, and I now am having trouble getting elements to vertically align. Normally, using Div's, I'd just add padding. In this case though the image is centered but the text is too low and needs to be bumped up a few pixels.

            @foreach(var c in companies)
            {
                var company = c.Company;
                <li class="ui-state-default">
                    <span>
                    <img src="..\..\Content\img\udarrow.png"/>
                    </span>
                    <span>
                    @company
                    </span>
                </li>
            }

Is there any way to do this?

In CSS:

.ui-state-default span {
    display: block;
}

尝试将跨度转换为块元素。

.ui-state-default span { display: block; }

I would rather make them inline-block than just block if they must lay inline with one another. Then just fiddle with the margins & padding.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM