1

我想让缩略图动态对齐,但我该怎么做呢?

我有以下代码:

HTML

      <div class="row-fluid">
        <ul class="thumbnails">

         <uc1:loadUsers runat="server" ID="loadUsers" />

        </ul>
      </div>

ASP.NET

这是一个用户控件

_str 是一个字符串,它将被添加到将其转换为 HTML 的文字控件中

                    _str =  "<li class='span3'>"
                        + "<div class='thumbnail'>"
                        + "<div class='caption'>"

                        + "<h3>" + _name + "</h3>"
                        + "<ul>"
                        + "<li><h5>" + _other + "</h5></li>"
                        + "<li><h5>" + _other + "</h5></li>"
                        + "<li><h5><img src='" + _imagePath + "'" + _size + " /> " + _other + "</h5></li>"
                        + "<br><li>"
                        + "<div class='btn-group'><button class='btn btn-info'>Options</button><button class='btn btn-info dropdown-toggle' data-toggle='dropdown'><span class='caret'></span></button><ul class='dropdown-menu'>"
                        + "<li><a href='users.aspx?delete=" + _id + "'><i class='icon-fire'></i> Delete</a></li>"
                        + "<li><a href='users.aspx?edit=" + _id + "'><i class='icon-edit'></i> Edit</a></li>"
                        + "</ul></div>"
                        + "</li>"
                        + "</ul>"

                        + "</div>"
                        + "</div>"
                        + "</li>";

我知道 class='row-fluid' 负责对齐,我该如何动态使用它?

如您所见,缩略图未对齐,我希望它们保持完全对齐

4

1 回答 1

1

问题是我正在插入<li>,但在 HTML 中我没有<ul>,这就是动态取消公式化的原因。所以我<div></div>在动态控件的开头和结尾插入了。

我很容易解决了这个问题:

_str =  "<div><li class='span3'>"
                    + "<div class='thumbnail'>"
                    + "<div class='caption'>"

                    + "<h3>" + _name + "</h3>"
                    + "<ul>"
                    + "<li><h5>" + _other + "</h5></li>"
                    + "<li><h5>" + _other + "</h5></li>"
                    + "<li><h5><img src='" + _imagePath + "'" + _size + " /> " + _other + "</h5></li>"
                    + "<br><li>"
                    + "<div class='btn-group'><button class='btn btn-info'>Options</button><button class='btn btn-info dropdown-toggle' data-toggle='dropdown'><span class='caret'></span></button><ul class='dropdown-menu'>"
                    + "<li><a href='users.aspx?delete=" + _id + "'><i class='icon-fire'></i> Delete</a></li>"
                    + "<li><a href='users.aspx?edit=" + _id + "'><i class='icon-edit'></i> Edit</a></li>"
                    + "</ul></div>"
                    + "</li>"
                    + "</ul>"

                    + "</div>"
                    + "</div>"
                    + "</li></div>";
于 2013-02-06T16:00:06.623 回答