【问题标题】:issue with spacing list items on a page页面上的间距列表项问题
【发布时间】:2016-03-02 11:09:26
【问题描述】:

我需要帮助来尝试在页面上放置无序列表的项目,如下所示:

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

像这样:

这是 HTML:(剃刀)

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

非常感谢任何帮助。

【问题讨论】:

  • 发布生成的 HTML 源代码可能更容易调试。我想它可以通过“text-align:right”或“float:right”CSS 属性来解决。但是只能用生成的代码说清楚...
  • 对,我现在编辑代码部分

标签: html css razor twitter-bootstrap-3


【解决方案1】:

可能的答案:将.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

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多