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

标签 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;    
}

非常感谢任何帮助。

最佳答案

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

.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

关于html - 页面上的间距列表项问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35745500/

相关文章:

jquery - 选择框的验证 CSS

c# - Razor ,C#,asp.net : how to display a line of pure text after @if comparison

asp.net-mvc - 单元测试 Razor View

html - 为什么 td 宽度会被忽略而变成 100%?

html - 在 CSS 中创建全高垂直菜单

javascript - 控制 iframe 将什么视为 window.top?

html - 在不破坏响应能力的情况下将图像卡在屏幕外

javascript - 编辑器中的 wordpress 双引号问题

jquery - 混合 Razor @和@: syntax in same line

jquery - div 在 Internet Explorer 中的位置