Removing black borders on a vimeo iframe embed using CSS?

前端 未结 8 2104
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-12 11:29

I am trying to find a way to hide the black strips across the top and bottom of a vimeo video. I thought there might be a way to cover them up with CSS.

I basically

8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-12 12:24

    Cut the 1px off all edges with CSS:

    .embed-container { 
        position: relative; 
        padding-bottom: 43%;        /* Aspect ratio of the video */
        height: 0; 
        overflow: hidden; 
        max-width: 100%;
    } 
    
    .embed-container iframe, 
    .embed-container object, 
    .embed-container embed { 
        position: absolute; 
        top: -1px; 
        left: -1px;
        width: calc(100% + 2px); 
        height: calc(100% + 2px);
    }
    

提交回复
热议问题