MediaWiki:Minerva.css: Difference between revisions

From ChinaEnglish
Jump to navigation Jump to search
Created page with "→All CSS here will be loaded for users of the MinervaNeue skin: →仅在查看首页时,针对 Minerva 皮肤生效: body.skin-minerva.page-Main_Page .header-container .branding-box h1 { →1. 将文字颜色设为透明,使其不可见: color: transparent !important; →2. 移除文字本身的背景,准备用图片作为背景: background-color: transparent !important; →3. 用你的图片作为背景: backgroun..."
 
No edit summary
Line 13: Line 13:
      
      
     /* 3. 用你的图片作为背景 */
     /* 3. 用你的图片作为背景 */
     background-image: url("你的图片完整URL地址");
     background-image: url("http://www.chinaenglish.com/images/HomeBanner.png");
     background-repeat: no-repeat;
     background-repeat: no-repeat;
     background-position: left center; /* 图片靠左,垂直居中 */
     background-position: left center; /* 图片靠左,垂直居中 */

Revision as of 14:36, 31 October 2026

/* All CSS here will be loaded for users of the MinervaNeue skin */




/* 仅在查看首页时,针对 Minerva 皮肤生效 */
body.skin-minerva.page-Main_Page .header-container .branding-box h1 {
    /* 1. 将文字颜色设为透明,使其不可见 */
    color: transparent !important;
    
    /* 2. 移除文字本身的背景,准备用图片作为背景 */
    background-color: transparent !important;
    
    /* 3. 用你的图片作为背景 */
    background-image: url("http://www.chinaenglish.com/images/HomeBanner.png");
    background-repeat: no-repeat;
    background-position: left center; /* 图片靠左,垂直居中 */
    background-size: contain; /* 或者使用 cover,根据图片比例调整 */
    
    /* 4. 根据图片高度调整这里的高度,确保图片能完整显示 */
    height: 40px; /* 示例高度,请按需修改 */
    width: 200px;  /* 示例宽度,请按需修改 */
    
    /* 保证文字透明后,原文字依然占据空间,从而“撑开”图片区域 */
    text-indent: -9999px; 
    overflow: hidden;
}