語言表達能力有限,直接上圖。我想作的效果就是左側是導航標題,右側是對應的內容條目。
可是右側內容條目數目不固定,所以對應的高度也不固定。這效果看似簡單,但本人半天沒想出來,苦讀一天文檔,終於找到解決方案(angularjs寫的)。angularjs
<style> .itemGroup { position: relative; } .itemGroupTitle { text-align: center; color: white; font-weight: bold; position: static; } .itemGroupTitle1 { position: absolute; width: inherit; height: 100%; } .itemGroupTitle2 { position: absolute; top: 0; right: 0; left: 0; bottom: 0; margin: auto; width: 140px; height: 20px; } </style> <div class="row itemGroup" ng-repeat="item in keyTypes.dataSource"> <div class="col-sm-2 itemGroupTitle"> <div class="itemGroupTitle1"><div class="itemGroupTitle2">{{item.GroupName}}></div></div> </div> <div class="col-sm-10 itemGroupContent"> <div class="row"> <div class="col-sm-6 item" ng-repeat="keytype in item.keyTypes">{{keytype.KeyTypeName}}</div> </div> </div> </div>