How to create a completely flexible piano keyboard with HTML and CSS

后端 未结 4 404
北恋
北恋 2021-01-16 06:43

I\'m trying to create a piano keyboard that will keep it\'s elements ratios using flex box, but can\'t seem to make the black notes stay the same width or height once I star

4条回答
  •  星月不相逢
    2021-01-16 07:05

    The position should be relative rather than absolute. Also you should set both the height of the containing divs to 100%.

    Refer to the Fiddle link: http://jsfiddle.net/924sefae/6/

    #kbd {
      height: 100%;
      ...
    }
    #kbd {
      height: 100%;
      ...
    }
    
    .black {
      position: relative;
      ...
    }
    

提交回复
热议问题