简体   繁体   中英

Why items in an UL list with `list-inline` bootstrap class goes to newline?

I have this list and I want to show this inline , I use list-inline class, but the result is not true . I don't know why this happened . Thanks for any answer .

cshtml code :

<ul  style="text-align: center; list-style-type: none;  vertical-align: top;">

                <li>
                    @foreach (var item in Model.SocialNetworks)
                    {
                        <ul class="list-inline" style="text-align:center;list-style-type:none;padding-top:15px;">
                            <li class="col-xs-3">
                                <a class="aFooter" href="@item.SocialLink">
                                    <img class="img-responsive center-block socialIcon" src="@Url.Content(item.SocialIcon.ToString())" />
                                </a>
                            </li>
                        </ul>
                    }
                </li>
            </ul>

Result :

在此处输入图片说明

Try float left to li element

ie, li{ float: left;}

Remove the padding-top: 15px; at the inside <li> tag.

With running fiddle .

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