页面上的间距列表项的问题

时间:2016-03-02 11:09:26

标签: html css razor twitter-bootstrap-3

我需要帮助尝试在页面上放置无序的项目列表,这是目前的样子:

enter image description here

我希望带有“拖动页面...”消息的边框位于右侧

像这样:enter image description here

这是HTML :( razor)

<div class="admin registrationFields white-strip padded">
    <div class="well container">
        <fieldset>
            <legend><span class="glyphicon glyphicon-file"></span>@ViewBag.Title</legend>

            <br/>
            <div class="form-group">
                @Html.LabelFor(model => model.SelectedSiteId, new {@class = "col-md-2"})
                <div class="col-md-6">
                    @Html.DropDownListFor(model => model.SelectedSiteId, new SelectList(Model.AllSites, "SiteId", "SiteName", Model.SelectedSiteId), new {@class = "form-control"})

                </div>

            </div>



            <ul class="list-group page-reordering">
                @foreach (var page in Model.Pages.Where(p => p.ParentMenuID == null))
                {
                    <li class="list-group-item margin-space-reorder" data-menuid="@page.MenuID">
                        <h4>@page.PageName</h4>
                        <ul class="list-group">

                            @foreach (var child in Model.Pages.Where(p => p.ParentMenuID == page.MenuID).OrderBy(o => o.MenuOrder))
                            {

                                <li class="list-group-item active" data-menuid="@child.MenuID">
                                    <h4>@child.PageName</h4>
                                </li>

                            }
                        </ul>
                    </li>
                }
            </ul>
            <input id="page-order" name="page-order" type="hidden" value="">
            <input type="button" value="Save" class="btn btn-primary" id="SaveOrderPage">
        </fieldset>
    </div>
</div>
}

这是css:

.page-reordering .list-group-item {
    background-color: #3071a9;  
}

.margin-space-reorder {
    margin: 15px 0;
}
.page-reordering .list-group {
   min-height: 60px;
   border: 1px #fff solid;
   border-radius: 5px;
}

.page-reordering .list-group:before {
    content: 'Drag a page here to create a child page of this parent.';
    color: #AEAEAE;
    font-size: 25px;
    font-style: italic;
    padding-left: 10px;    
}

.page-reordering .list-group-item h4 {
   color: #fff;    
}
.page-reordering .list-group-item li h4 {
   padding-left: 1px;    
}

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:0)

可能的答案:使.page-reordering .list-group::before元素成为块元素,这样它就可以从父元素继承宽度,然后将文本对齐到右边。

.page-reordering .list-group::before {
content: 'Drag a page here to create a child page of this parent.';
color: #AEAEAE;
font-size: 25px;
font-style: italic;
padding-left: 10px;
text-align: right;
width: inherit;
display: block;
}

示例jsfiddle