2021年1月21日 星期四

讓元素寬度自動設為剩餘可用寬度

<div style="display:flex">
<input type="text" style="width:4em">
<select style="flex-grow:1;flex-basis: 0;"></select> 
</div>

下拉選單寬度會等於div 扣除input 後剩餘寬度 (不可設定 width 否則會失效)

若要讓高度設為剩餘可用高度
<div style="height: 100%; display: flex; flex-direction: column;">
  <div>123</div>
  <div style="flex-grow: 1; flex-basis: 0;">剩餘可用高度</div>
</div>

沒有留言:

自訂權限驗證機制

// 使用 filter [Route("api/[controller]")] [ApiController] [Authorize] [TypeFilter(typeof(CustomAsyncAuthorizationFilter))] public c...