这个想法来源于远景上一个css的代码回帖,当时想到safari浏览器可以自动调整标签页为图标模式,觉得有点意思。

琢磨了一会儿,修改出代码。(注意,查看css中不要在其他位置对标签页宽度另外又做了设置,可能会冲突不起作用)

/*标签页自动缩小*/
/* 选中的时候缩小为135px,没有选中的时候缩小为30px  */ 
     .tabbrowser-tab{
    margin-right:5px !important;
    }
    .tabbrowser-tab:is([selected="true"]):not([pinned])[fadein]  { 
            min-width: 135px !important; 
            max-width: 135px !important;            
        }          
     
    .tabbrowser-tab:not([selected="true"]):not([pinned])[fadein]   {
            min-width: 35px !important; 
            max-width: 35px !important;
        }

/*收起标签的时候文字隐藏,点开时候恢复*/
        .tab-label:is([selected="true"]):not([pinned])[fadein]{
        display:block !important;
        }         
        .tab-label:not([selected="true"]):not([pinned])[fadein]{
        display:none !important;
        }
		
/** 为空白标签加上图标 Add icon for blank tabs,来自卡饭逗妇乳 */
        #TabsToolbar .tabbrowser-tab .tab-icon-image:not([src]):not([busy]):not([pending]),
        #TabsToolbar .tabbrowser-tab .tab-icon-image:not([src]):not([busy]):not([pending]):not([selected]) {
            display: inline !important;
            list-style-image: url("chrome://global/skin/icons/defaultFavicon.svg") !important;
        }

这个:not([pinned])[fadein]如果不加,在mac或者有些windows系统中会出现一个问题,就是中键关闭当中某一个标签页的时候,其他的不会自动排位置,在关闭标签页的地方会形成一个空白。