position:fixed and width:inherit with percentage parent

后端 未结 4 1310
清歌不尽
清歌不尽 2021-02-14 03:17

I\'m trying to give a fixed element a width of a percentage parent (here #container). When I use pixel instead of the percentage then it works

4条回答
  •  旧巷少年郎
    2021-02-14 03:49

    You have #outer as width:300px, #container as 90% means 270px, now you have given width:inherit and position:fixed that is ambiguous to browser, so use position:fixed with width:x% for #fixed

提交回复
热议问题