我没有JS和Angular的经验。我现在正在学习。我尝试了许多不同的变体,但没有一个好的解决方案。我需要使复选框组件始终在左侧对齐,并且无论文本有多大都可以看到。当我使用style =“ width:300px”时,它可以工作,但它看起来像硬编码的解决方案。
<div class="col-md-5">
<div class="panel panel-default">
<div class="panel-heading">Available Permissions</div>
<div class="panel-body no-padding">
<md-content style="height: 400px;">
<section>
<div class="md-primary md-subheader" style="position: sticky; top: 0; z-index: 2;">
<div class="md-subheader-inner">
<div class="md-subheader-content">
<md-input-container class="md-block">
<label for="availableSearchTerm">Search</label>
<input type="text"
name="availableSearchTerm"
id="availableSearchTerm"
data-ng-model="availableSearchTerm"
data-ng-change="searchPermissions(availableSearchTerm, availablePermissions)"/>
</md-input-container>
</div>
</div>
</div>
<md-list class="no-padding" role="list">
<md-list-item class="md-3-line md-no-proxy" role="listitem" data-ng-repeat="permission in searchPermissions(availableSearchTerm, availablePermissions)">
<md-checkbox aria-label="Permission Chekbox" type="checkbox" role="checkbox" tabindex="0" data-ng-click="selectPermission(permission)"/>
<div class="md-list-item-text">
<h3>{{permission.name}}</h3>
<h4>{{permission.description}}</h4>
</div>
</md-list-item>
</md-list>
</section>
</md-content>
</div>
</div>
</div>
<div class="col-md-2 text-center" style="padding-top: 180px;">
<button type="button" data-ng-click="assignPermissions()" class="md-raised btn-w-xs md-default md-button md-ink-ripple" uib-tooltip="Assign Permissions" tooltip-append-to-body="true">
<i class="fa fa-arrow-right"/>
</button>
<button type="button" data-ng-click="removePermissions()" class="md-raised btn-w-xs md-default md-button md-ink-ripple" uib-tooltip="Remove Permissions" tooltip-append-to-body="true" style="margin-top: 10px;">
<i class="fa fa-arrow-left"/>
</button>
</div>
<div class="col-md-5">
<div class="panel panel-default">
<div class="panel-heading">Assigned Permissions</div>
<div class="panel-body no-padding">
<md-content style="height: 400px;">
<section>
<div class="md-primary md-subheader" style="position: sticky; top: 0; z-index: 2;">
<div class="md-subheader-inner">
<div class="md-subheader-content">
<md-input-container class="md-block">
<label for="assignedSearchTerm">Search</label>
<input type="text"
name="assignedSearchTerm"
id="assignedSearchTerm"
data-ng-model="assignedSearchTerm"
data-ng-change="searchPermissions(assignedSearchTerm, user.permissions)" />
</md-input-container>
</div>
</div>
</div>
<md-list class="no-padding" role="list">
<md-list-item class="md-3-line md-no-proxy" role="listitem" data-ng-repeat="permission in searchPermissions(assignedSearchTerm, user.permissions)">
<md-checkbox aria-label="Permission Chekbox" type="checkbox" role="checkbox" tabindex="0" data-ng-click="selectPermission(permission)"/>
<div class="md-list-item-text">
<h3>{{permission.name}}</h3>
<h4>{{permission.description}}</h4>
</div>
</md-list-item>
</md-list>
</section>
</md-content>
</div>
</div>
</div>
答案 0 :(得分:0)
这将包裹长文本。
.md-list-item-text h3,
.md-list-item-text h4{
white-space: normal;
word-wrap: break-word;
overflow-wrap: break-word;
word-break: break-all;
}